forked from qt-creator/qt-creator
qmldesigner: fix "list is empty" warning
message was: "QFileSystemWatcher::removePaths: list is empty" now calling that method only if there is something in the list. Also tried to make the code a bit cleaner Change-Id: I029d100e63cf42eb58757a144fecaaa8c8c908a0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -1812,22 +1812,24 @@ void NodeInstanceView::updateWatcher(const QString &path)
|
|||||||
QStringList newFiles;
|
QStringList newFiles;
|
||||||
QStringList newDirs;
|
QStringList newDirs;
|
||||||
|
|
||||||
|
const QStringList files = m_fileSystemWatcher->files();
|
||||||
|
const QStringList directories = m_fileSystemWatcher->directories();
|
||||||
if (path.isEmpty()) {
|
if (path.isEmpty()) {
|
||||||
// Do full update
|
// Do full update
|
||||||
rootPath = QFileInfo(model()->fileUrl().toLocalFile()).absolutePath();
|
rootPath = QFileInfo(model()->fileUrl().toLocalFile()).absolutePath();
|
||||||
m_fileSystemWatcher->removePaths(m_fileSystemWatcher->directories());
|
if (!directories.isEmpty())
|
||||||
m_fileSystemWatcher->removePaths(m_fileSystemWatcher->files());
|
m_fileSystemWatcher->removePaths(directories);
|
||||||
|
if (!files.isEmpty())
|
||||||
|
m_fileSystemWatcher->removePaths(files);
|
||||||
} else {
|
} else {
|
||||||
rootPath = path;
|
rootPath = path;
|
||||||
const QStringList files = m_fileSystemWatcher->files();
|
|
||||||
const QStringList dirs = m_fileSystemWatcher->directories();
|
|
||||||
for (const auto &file : files) {
|
for (const auto &file : files) {
|
||||||
if (file.startsWith(path))
|
if (file.startsWith(path))
|
||||||
oldFiles.append(file);
|
oldFiles.append(file);
|
||||||
}
|
}
|
||||||
for (const auto &dir : dirs) {
|
for (const auto &directory : directories) {
|
||||||
if (dir.startsWith(path))
|
if (directory.startsWith(path))
|
||||||
oldDirs.append(dir);
|
oldDirs.append(directory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user