fix getting settings directory on windows
authoralfadur
Wed, 01 May 2019 23:11:22 +0300
changeset 14872 18bfa0a3c117
parent 14871 0f39f8efbd2e
child 14873 d17c1a28df17
fix getting settings directory on windows
QTfrontend/main.cpp
--- a/QTfrontend/main.cpp	Wed May 01 21:59:41 2019 +0300
+++ b/QTfrontend/main.cpp	Wed May 01 23:11:22 2019 +0300
@@ -328,10 +328,10 @@
         checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars");
         cfgdir->cd("Library/Application Support/Hedgewars");
 #elif defined _WIN32
-        char path[1024];
-        if(!SHGetFolderPathA(0, CSIDL_PERSONAL, NULL, 0, path))
+        wchar_t path[MAX_PATH];
+        if(SHGetFolderPathW(0, CSIDL_PERSONAL, NULL, 0, path) == S_OK)
         {
-            cfgdir->cd(path);
+            cfgdir->cd(QString::fromWCharArray(path));
             checkForDir(cfgdir->absolutePath() + "/Hedgewars");
             cfgdir->cd("Hedgewars");
         }