diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-07-16 15:35:58 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-17 15:56:15 +0200 |
commit | fe4adec894a8294516cd6aa02c5cbae2e7d8e8db (patch) | |
tree | 2ab61c463a3dfb1d7392ea80269c8fc0369a1b6f /src | |
parent | dc4cd551c66111a9d3876dc324f7e52fc3cca2a6 (diff) |
Windows: Do not return short path names for QDir::tempPath().
WinAPI GetTempPath() sometimes returns short names
for C:/Users/<user>/AppData/Local/Temp.
Change-Id: I33f991acc06e652ccd484d36a5a384eb776f8395
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qfilesystemengine_win.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index e7a949a77a..6041edb252 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -1060,9 +1060,19 @@ QString QFileSystemEngine::tempPath() { QString ret; wchar_t tempPath[MAX_PATH]; - DWORD len = GetTempPath(MAX_PATH, tempPath); + const DWORD len = GetTempPath(MAX_PATH, tempPath); +#ifdef Q_OS_WINCE if (len) ret = QString::fromWCharArray(tempPath, len); +#else + if (len) { // GetTempPath() can return short names, expand. + wchar_t longTempPath[MAX_PATH]; + const DWORD longLen = GetLongPathName(tempPath, longTempPath, MAX_PATH); + ret = longLen && longLen < MAX_PATH ? + QString::fromWCharArray(longTempPath, longLen) : + QString::fromWCharArray(tempPath, len); + } +#endif if (!ret.isEmpty()) { while (ret.endsWith(QLatin1Char('\\'))) ret.chop(1); |