forked from qt-creator/qt-creator
Utils: improve filewatcher
Avoid internal calls of QFileSystemEngine::fillMetaData which are expensive and especially on Windows trow GetFileAttributesEx can hang for seconds. (network drive or one drive which locks files) Task-number: QDS-8820 Change-Id: I3269ade03d1c1ed65417eebf956080414c5d087b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "filesystemwatcher.h"
|
#include "filesystemwatcher.h"
|
||||||
#include "globalfilechangeblocker.h"
|
#include "globalfilechangeblocker.h"
|
||||||
|
#include "filepath.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileSystemWatcher>
|
#include <QFileSystemWatcher>
|
||||||
@@ -437,9 +438,9 @@ void FileSystemWatcher::slotDirectoryChanged(const QString &path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QStringList toReadd;
|
QStringList toReadd;
|
||||||
const QDir dir(path);
|
const auto dir = FilePath::fromString(path);
|
||||||
for (const QFileInfo &entry : dir.entryInfoList(QDir::Files)) {
|
for (const FilePath &entry : dir.dirEntries(QDir::Files)) {
|
||||||
const QString file = entry.filePath();
|
const QString file = entry.toString();
|
||||||
if (d->m_files.contains(file))
|
if (d->m_files.contains(file))
|
||||||
toReadd.append(file);
|
toReadd.append(file);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user