Utils: Use callbacks when iterating remote file systems

This will make recursion easier and has the potential to avoid creating
big intermediate lists.

Change-Id: I44d42925dae9c0048338c7d0a6aa26606f314c28
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2021-12-14 12:15:40 +01:00
parent 9a28edfd87
commit 7677dc4ba0
11 changed files with 94 additions and 96 deletions

View File

@@ -32,7 +32,6 @@
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectexplorericons.h>
@@ -755,12 +754,9 @@ void DebuggerItemManagerPrivate::autoDetectGdbOrLldbDebuggers(const FilePaths &s
if (searchPaths.isEmpty())
return;
IDevice::ConstPtr device = DeviceManager::deviceForPath(searchPaths.front());
QTC_ASSERT(device, return);
FilePaths suspects;
if (device->osType() == OsTypeMac) {
if (searchPaths.front().osType() == OsTypeMac) {
QtcProcess proc;
proc.setTimeoutS(2);
proc.setCommand({"xcrun", {"--find", "lldb"}});
@@ -782,9 +778,9 @@ void DebuggerItemManagerPrivate::autoDetectGdbOrLldbDebuggers(const FilePaths &s
paths = Utils::filteredUnique(paths);
for (const FilePath &path : paths) {
suspects.append(device->directoryEntries(path, filters, QDir::Files | QDir::Executable));
}
const auto addSuspect = [&suspects](const FilePath &entry) { suspects.append(entry); return true; };
for (const FilePath &path : paths)
path.iterateDirectory(addSuspect, filters, QDir::Files | QDir::Executable);
QStringList logMessages{tr("Searching debuggers...")};
for (const FilePath &command : qAsConst(suspects)) {