From cb5815c619466f690d130a8816dd84c605d3c4bc Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 7 Oct 2022 12:04:31 +0200 Subject: [PATCH] RemoteLinux: Use common FileUtils::iterateUnixDirector function This now uses 'find' when available. Change-Id: I5ebf05a808f69559c25cd33eb6d36ab931fb076f Reviewed-by: Christian Kandeler --- src/plugins/remotelinux/linuxdevice.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index ce97e2a5a73..95c9f4dbbb1 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -370,6 +370,7 @@ public: ShellThreadHandler *m_handler = nullptr; mutable QMutex m_shellMutex; QList m_terminals; + bool m_useFind = true; }; // SshProcessImpl @@ -1315,11 +1316,10 @@ void LinuxDevice::iterateDirectory(const FilePath &filePath, const FileFilter &filter) const { QTC_ASSERT(handlesFile(filePath), return); - // if we do not have find - use ls as fallback - const QByteArray output = d->outputForRunInShell({"ls", {"-1", "-b", "--", filePath.path()}}) - .value_or(QByteArray()); - const QStringList entries = QString::fromUtf8(output).split('\n', Qt::SkipEmptyParts); - FileUtils::iterateLsOutput(filePath, entries, filter, callBack); + auto runInShell = [this](const CommandLine &cmd) { + return d->outputForRunInShell(cmd).value_or(QByteArray()); + }; + FileUtils::iterateUnixDirectory(filePath, filter, &d->m_useFind, runInShell, callBack); } std::optional LinuxDevice::fileContents(const FilePath &filePath,