Introduce separate mapping of QStandardPaths's CLSIDs for Windows CE.

CSIDL_APPDATA should be used instead of CSIDL_LOCAL_APPDATA
on Windows CE. Amends 910f719bd1 .

Task-number: QTBUG-50570
Change-Id: I0cc310ef5fe3fbaefae9c84dd9db8cf48ff48499
Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com>
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
This commit is contained in:
Friedemann Kleint 2016-03-17 09:48:08 +01:00
parent 09acf326db
commit aa3008dfa1

View File

@ -111,6 +111,7 @@ static inline void appendTestMode(QString &path)
// Map QStandardPaths::StandardLocation to CLSID of SHGetSpecialFolderPath() // Map QStandardPaths::StandardLocation to CLSID of SHGetSpecialFolderPath()
static int writableSpecialFolderClsid(QStandardPaths::StandardLocation type) static int writableSpecialFolderClsid(QStandardPaths::StandardLocation type)
{ {
#ifndef Q_OS_WINCE
static const int clsids[] = { static const int clsids[] = {
CSIDL_DESKTOPDIRECTORY, // DesktopLocation CSIDL_DESKTOPDIRECTORY, // DesktopLocation
CSIDL_PERSONAL, // DocumentsLocation CSIDL_PERSONAL, // DocumentsLocation
@ -130,6 +131,27 @@ static int writableSpecialFolderClsid(QStandardPaths::StandardLocation type)
CSIDL_APPDATA, // AppDataLocation ("Roaming" path) CSIDL_APPDATA, // AppDataLocation ("Roaming" path)
CSIDL_LOCAL_APPDATA, // AppConfigLocation ("Local" path) CSIDL_LOCAL_APPDATA, // AppConfigLocation ("Local" path)
}; };
#else // !Q_OS_WINCE
static const int clsids[] = {
CSIDL_DESKTOPDIRECTORY, // DesktopLocation
CSIDL_PERSONAL, // DocumentsLocation
CSIDL_FONTS, // FontsLocation
CSIDL_PROGRAMS, // ApplicationsLocation
CSIDL_MYMUSIC, // MusicLocation
CSIDL_MYVIDEO, // MoviesLocation
CSIDL_MYPICTURES, // PicturesLocation
-1, -1, // TempLocation/HomeLocation
CSIDL_APPDATA, // AppLocalDataLocation, AppLocalDataLocation = DataLocation
-1, // CacheLocation
CSIDL_APPDATA, // GenericDataLocation
-1, // RuntimeLocation
CSIDL_APPDATA, // ConfigLocation
-1, -1, // DownloadLocation/GenericCacheLocation
CSIDL_APPDATA, // GenericConfigLocation
CSIDL_APPDATA, // AppDataLocation
CSIDL_APPDATA, // AppConfigLocation
};
#endif // Q_OS_WINCE
Q_STATIC_ASSERT(sizeof(clsids) / sizeof(clsids[0]) == size_t(QStandardPaths::AppConfigLocation + 1)); Q_STATIC_ASSERT(sizeof(clsids) / sizeof(clsids[0]) == size_t(QStandardPaths::AppConfigLocation + 1));
return size_t(type) < sizeof(clsids) / sizeof(clsids[0]) ? clsids[type] : -1; return size_t(type) < sizeof(clsids) / sizeof(clsids[0]) ? clsids[type] : -1;