Utils: Silence watch() warnings if path does not exist

Change-Id: I3764f16f96688a881391c2a026d34174a2ae039f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-09-02 12:38:22 +02:00
parent 2355c09056
commit ee43d68ffd

View File

@@ -473,7 +473,7 @@ class DesktopFilePathWatcher final : public FilePathWatcher
if (it == m_watchClients.end()) { if (it == m_watchClients.end()) {
QMetaObject::invokeMethod(&m_watcher, [this, path] { QMetaObject::invokeMethod(&m_watcher, [this, path] {
bool res = m_watcher.addPath(path.path()); bool res = m_watcher.addPath(path.path());
QTC_CHECK(res); QTC_CHECK(res || !path.exists());
}); });
it = m_watchClients.emplace(path); it = m_watchClients.emplace(path);
} }
@@ -489,7 +489,7 @@ class DesktopFilePathWatcher final : public FilePathWatcher
if (it->size() == 0) { if (it->size() == 0) {
QMetaObject::invokeMethod(&m_watcher, [this, path] { QMetaObject::invokeMethod(&m_watcher, [this, path] {
bool res = m_watcher.removePath(path.path()); bool res = m_watcher.removePath(path.path());
QTC_CHECK(res); QTC_CHECK(res || !path.exists());
}); });
m_watchClients.erase(it); m_watchClients.erase(it);