From 738896d6b9bb9c521fcc7dd3d7418664411164a6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 11 Jan 2012 16:58:45 +0100 Subject: QFileSystemWatcher/Windows: Output paths if FindNext fails. Change-Id: I72bd28868c84d37e3dd4ea8ab892fa092d853d4a Reviewed-by: Bradley T. Hughes --- src/corelib/io/qfilesystemwatcher_win.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp index 4f2ff9370d..3028f94b0e 100644 --- a/src/corelib/io/qfilesystemwatcher_win.cpp +++ b/src/corelib/io/qfilesystemwatcher_win.cpp @@ -50,6 +50,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -312,6 +313,17 @@ QWindowsFileSystemWatcherEngineThread::~QWindowsFileSystemWatcherEngineThread() } } +static inline QString msgFindNextFailed(const QHash &pathInfos) +{ + QString result; + QTextStream str(&result); + str << "QFileSystemWatcher: FindNextChangeNotification failed for"; + foreach (const QWindowsFileSystemWatcherEngine::PathInfo &pathInfo, pathInfos) + str << " \"" << QDir::toNativeSeparators(pathInfo.absolutePath) << '"'; + str << ' '; + return result; +} + void QWindowsFileSystemWatcherEngineThread::run() { QMutexLocker locker(&mutex); @@ -342,11 +354,11 @@ void QWindowsFileSystemWatcherEngineThread::run() // for some reason, so we must check if the handle exist in the handles vector if (handles.contains(handle)) { // qDebug()<<"thread"< &h = pathInfoForHandle[handle]; if (!FindNextChangeNotification(handle)) { - qErrnoWarning("QFileSystemWatcher: FindNextChangeNotification failed!!"); + const DWORD error = GetLastError(); + qErrnoWarning(error, "%s", qPrintable(msgFindNextFailed(h))); } - - QHash &h = pathInfoForHandle[handle]; QMutableHashIterator it(h); while (it.hasNext()) { QHash::iterator x = it.next(); -- cgit v1.2.3