From aa3008dfa1e3dfa0f6a35999ae62e4c012ad8089 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Date: Thu, 17 Mar 2016 09:48:08 +0100
Subject: [PATCH] Introduce separate mapping of QStandardPaths's CLSIDs for
 Windows CE.

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

Task-number: QTBUG-50570
Change-Id: I0cc310ef5fe3fbaefae9c84dd9db8cf48ff48499
Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com>
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
---
 src/corelib/io/qstandardpaths_win.cpp | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index 73d49cbc25..c1b34d1341 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -111,6 +111,7 @@ static inline void appendTestMode(QString &path)
 // Map QStandardPaths::StandardLocation to CLSID of SHGetSpecialFolderPath()
 static int writableSpecialFolderClsid(QStandardPaths::StandardLocation type)
 {
+#ifndef Q_OS_WINCE
     static const int clsids[] = {
         CSIDL_DESKTOPDIRECTORY, // DesktopLocation
         CSIDL_PERSONAL,         // DocumentsLocation
@@ -130,6 +131,27 @@ static int writableSpecialFolderClsid(QStandardPaths::StandardLocation type)
         CSIDL_APPDATA,          // AppDataLocation ("Roaming" 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));
     return size_t(type) < sizeof(clsids) / sizeof(clsids[0]) ? clsids[type] : -1;