diff options
Diffstat (limited to 'src/corelib/io/qfilesystemwatcher_win.cpp')
-rw-r--r-- | src/corelib/io/qfilesystemwatcher_win.cpp | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp index 4c53e4faac..a0b2b006d6 100644 --- a/src/corelib/io/qfilesystemwatcher_win.cpp +++ b/src/corelib/io/qfilesystemwatcher_win.cpp @@ -317,9 +317,9 @@ QWindowsFileSystemWatcherEngine::QWindowsFileSystemWatcherEngine(QObject *parent QWindowsFileSystemWatcherEngine::~QWindowsFileSystemWatcherEngine() { - for (auto *thread : qAsConst(threads)) + for (auto *thread : std::as_const(threads)) thread->stop(); - for (auto *thread : qAsConst(threads)) + for (auto *thread : std::as_const(threads)) thread->wait(); qDeleteAll(threads); } @@ -332,12 +332,7 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths, QStringList unhandled; for (const QString &path : paths) { auto sg = qScopeGuard([&] { unhandled.push_back(path); }); - QString normalPath = path; - if ((normalPath.endsWith(u'/') && !normalPath.endsWith(":/"_L1)) - || (normalPath.endsWith(u'\\') && !normalPath.endsWith(":\\"_L1))) { - normalPath.chop(1); - } - QFileInfo fileInfo(normalPath); + QFileInfo fileInfo(path); fileInfo.stat(); if (!fileInfo.exists()) continue; @@ -351,7 +346,7 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths, continue; } - DEBUG() << "Looking for a thread/handle for" << normalPath; + DEBUG() << "Looking for a thread/handle for" << fileInfo.path(); const QString absolutePath = isDir ? fileInfo.absoluteFilePath() : fileInfo.absolutePath(); const uint flags = isDir @@ -433,7 +428,7 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths, // now look for a thread to insert bool found = false; - for (QWindowsFileSystemWatcherEngineThread *thread : qAsConst(threads)) { + for (QWindowsFileSystemWatcherEngineThread *thread : std::as_const(threads)) { const auto locker = qt_scoped_lock(thread->mutex); if (thread->handles.count() < MAXIMUM_WAIT_OBJECTS) { DEBUG() << "Added handle" << handle.handle << "for" << absolutePath << "to watch" << fileInfo.absoluteFilePath() @@ -495,11 +490,8 @@ QStringList QWindowsFileSystemWatcherEngine::removePaths(const QStringList &path QStringList unhandled; for (const QString &path : paths) { auto sg = qScopeGuard([&] { unhandled.push_back(path); }); - QString normalPath = path; - if (normalPath.endsWith(u'/') || normalPath.endsWith(u'\\')) - normalPath.chop(1); - QFileInfo fileInfo(normalPath); - DEBUG() << "removing" << normalPath; + QFileInfo fileInfo(path); + DEBUG() << "removing" << fileInfo.path(); QString absolutePath = fileInfo.absoluteFilePath(); QList<QWindowsFileSystemWatcherEngineThread *>::iterator jt, end; end = threads.end(); @@ -586,7 +578,7 @@ QWindowsFileSystemWatcherEngineThread::~QWindowsFileSystemWatcherEngineThread() CloseHandle(handles.at(0)); handles[0] = INVALID_HANDLE_VALUE; - for (HANDLE h : qAsConst(handles)) { + for (HANDLE h : std::as_const(handles)) { if (h == INVALID_HANDLE_VALUE) continue; FindCloseChangeNotification(h); |