forked from qt-creator/qt-creator
RemoteLinux: Use common FileUtils::iterateUnixDirector function
This now uses 'find' when available. Change-Id: I5ebf05a808f69559c25cd33eb6d36ab931fb076f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -370,6 +370,7 @@ public:
|
|||||||
ShellThreadHandler *m_handler = nullptr;
|
ShellThreadHandler *m_handler = nullptr;
|
||||||
mutable QMutex m_shellMutex;
|
mutable QMutex m_shellMutex;
|
||||||
QList<QtcProcess *> m_terminals;
|
QList<QtcProcess *> m_terminals;
|
||||||
|
bool m_useFind = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
// SshProcessImpl
|
// SshProcessImpl
|
||||||
@@ -1315,11 +1316,10 @@ void LinuxDevice::iterateDirectory(const FilePath &filePath,
|
|||||||
const FileFilter &filter) const
|
const FileFilter &filter) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(handlesFile(filePath), return);
|
QTC_ASSERT(handlesFile(filePath), return);
|
||||||
// if we do not have find - use ls as fallback
|
auto runInShell = [this](const CommandLine &cmd) {
|
||||||
const QByteArray output = d->outputForRunInShell({"ls", {"-1", "-b", "--", filePath.path()}})
|
return d->outputForRunInShell(cmd).value_or(QByteArray());
|
||||||
.value_or(QByteArray());
|
};
|
||||||
const QStringList entries = QString::fromUtf8(output).split('\n', Qt::SkipEmptyParts);
|
FileUtils::iterateUnixDirectory(filePath, filter, &d->m_useFind, runInShell, callBack);
|
||||||
FileUtils::iterateLsOutput(filePath, entries, filter, callBack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<QByteArray> LinuxDevice::fileContents(const FilePath &filePath,
|
std::optional<QByteArray> LinuxDevice::fileContents(const FilePath &filePath,
|
||||||
|
|||||||
Reference in New Issue
Block a user