diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2014-12-04 08:09:30 (GMT) |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2014-12-04 19:17:47 (GMT) |
commit | 933ae21b9925f1d9fc467e1ecb72eb91b5892d61 (patch) | |
tree | 080c56ce34f1d2cad41d99d03011be1dda7fc802 /src | |
parent | 74112db92ca8582ac09a2f877e87177e7d46ea7b (diff) | |
download | Qt-933ae21b9925f1d9fc467e1ecb72eb91b5892d61.zip Qt-933ae21b9925f1d9fc467e1ecb72eb91b5892d61.tar.gz Qt-933ae21b9925f1d9fc467e1ecb72eb91b5892d61.tar.bz2 |
Windows: Fix return value of QDesktopServices::storageLocation(DataLocation).
Return empty string if SHGetSpecialFolderPath() fails for DataLocation, ie,
the directory does not exist.
Change-Id: I2abf41174b904fe36e587894832c0f3f4947dc1e
Task-number: QTBUG-43092
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/util/qdesktopservices_win.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp index 1bf3654..9ac6f4a 100644 --- a/src/gui/util/qdesktopservices_win.cpp +++ b/src/gui/util/qdesktopservices_win.cpp @@ -196,15 +196,16 @@ QString QDesktopServices::storageLocation(StandardLocation type) switch (type) { case DataLocation: #if defined Q_WS_WINCE - if (SHGetSpecialFolderPath(0, path, CSIDL_APPDATA, FALSE)) + if (SHGetSpecialFolderPath(0, path, CSIDL_APPDATA, FALSE)) { #else - if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE)) + if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE)) { #endif result = QString::fromWCharArray(path); - if (!QCoreApplication::organizationName().isEmpty()) - result = result + QLatin1String("\\") + QCoreApplication::organizationName(); - if (!QCoreApplication::applicationName().isEmpty()) - result = result + QLatin1String("\\") + QCoreApplication::applicationName(); + if (!QCoreApplication::organizationName().isEmpty()) + result += QLatin1String("\\") + QCoreApplication::organizationName(); + if (!QCoreApplication::applicationName().isEmpty()) + result += QLatin1String("\\") + QCoreApplication::applicationName(); + } break; case DesktopLocation: |