From 933ae21b9925f1d9fc467e1ecb72eb91b5892d61 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 4 Dec 2014 09:09:30 +0100 Subject: 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 --- src/gui/util/qdesktopservices_win.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp index 1bf3654b61..9ac6f4a7d3 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: -- cgit v1.2.1