diff options
author | Daniel Molkentin <danimo@owncloud.com> | 2014-11-06 14:54:33 +0300 |
---|---|---|
committer | Daniel Molkentin <danimo@owncloud.com> | 2014-11-06 14:54:33 +0300 |
commit | 89670e5ce4f7155118548a37db56c84e10bcef25 (patch) | |
tree | dfa84ea9eb9455fb05acaa1a2558d35e62c26dd9 /src/mirall | |
parent | 96a7118d05ada8eca1eaee06d76a93cf02f21761 (diff) |
Folderwatcher_win: handle conversion error
Diffstat (limited to 'src/mirall')
-rw-r--r-- | src/mirall/folderwatcher_win.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mirall/folderwatcher_win.cpp b/src/mirall/folderwatcher_win.cpp index b4b8f7fdc..628775472 100644 --- a/src/mirall/folderwatcher_win.cpp +++ b/src/mirall/folderwatcher_win.cpp @@ -56,11 +56,14 @@ void WatcherThread::run() size_t len = pFileNotify->FileNameLength / 2; QString file = _path + "\\" + QString::fromWCharArray(pFileNotify->FileName, len); + QString longfile; QScopedArrayPointer<TCHAR> buffer(new TCHAR[maxlen]); if (GetLongPathNameW(reinterpret_cast<LPCWSTR>(file.utf16()), buffer.data(), maxlen) == 0) { - qDebug() << "Error converting file name to full length"; + qDebug() << Q_FUNC_INFO << "Error converting file name to full length, resorting to original name."; + longfile = file; + } else { + longfile = QString::fromUtf16(reinterpret_cast<const ushort *>(buffer.data()), maxlen-1); } - const QString longfile = QString::fromUtf16(reinterpret_cast<const ushort *>(buffer.data()), maxlen-1); qDebug() << Q_FUNC_INFO << "Found change in" << file; emit changed(longfile); |