diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-01-11 16:58:45 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-12 12:08:19 +0100 |
commit | 738896d6b9bb9c521fcc7dd3d7418664411164a6 (patch) | |
tree | 50a107ee12518f33a817fa0ea37c2c92e741b965 /src/corelib/io/qfilesystemwatcher_win.cpp | |
parent | ff5ae4a5785a12089910feda533e8230498ccfb7 (diff) |
QFileSystemWatcher/Windows: Output paths if FindNext fails.
Change-Id: I72bd28868c84d37e3dd4ea8ab892fa092d853d4a
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/corelib/io/qfilesystemwatcher_win.cpp')
-rw-r--r-- | src/corelib/io/qfilesystemwatcher_win.cpp | 18 |
1 files 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 <qset.h> #include <qdatetime.h> #include <qdir.h> +#include <qtextstream.h> QT_BEGIN_NAMESPACE @@ -312,6 +313,17 @@ QWindowsFileSystemWatcherEngineThread::~QWindowsFileSystemWatcherEngineThread() } } +static inline QString msgFindNextFailed(const QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo> &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"<<this<<"Acknowledged handle:"<<at<<handle; + QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo> &h = pathInfoForHandle[handle]; if (!FindNextChangeNotification(handle)) { - qErrnoWarning("QFileSystemWatcher: FindNextChangeNotification failed!!"); + const DWORD error = GetLastError(); + qErrnoWarning(error, "%s", qPrintable(msgFindNextFailed(h))); } - - QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo> &h = pathInfoForHandle[handle]; QMutableHashIterator<QString, QWindowsFileSystemWatcherEngine::PathInfo> it(h); while (it.hasNext()) { QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo>::iterator x = it.next(); |