pass unicode paths as base64 on windows
authoralfadur
Mon, 09 May 2022 23:58:51 +0300
changeset 15845 ad43384fbbe9
parent 15844 4e3c340eb766
child 15846 78745063cf33
pass unicode paths as base64 on windows
QTfrontend/game.cpp
hedgewars/ArgParsers.pas
--- a/QTfrontend/game.cpp	Mon May 09 20:11:38 2022 +0300
+++ b/QTfrontend/game.cpp	Mon May 09 23:58:51 2022 +0300
@@ -600,10 +600,31 @@
     arguments << "--internal"; //Must be passed as first argument
     arguments << "--port";
     arguments << QString("%1").arg(ipc_port);
+#ifdef _WIN32
+    {
+        QString path = datadir->absolutePath();
+        if (path == QLatin1String(path.toLatin1())) {
+            arguments << "--prefix";
+            arguments << path;
+        } else {
+            arguments << "--prefix64";
+            arguments << path.toUtf8().toBase64();
+        }    
+        path = cfgdir->absolutePath();
+        if (path == QLatin1String(path.toLatin1())) {
+            arguments << "--user-prefix";
+            arguments << path;
+        } else {
+            arguments << "--user-prefix64";
+            arguments << path.toUtf8().toBase64();
+        }
+    }         
+#else 
     arguments << "--prefix";
     arguments << datadir->absolutePath();
     arguments << "--user-prefix";
-    arguments << cfgdir->absolutePath();
+    arguments << cfgdir->absolutePath();    
+#endif
     arguments << "--locale";
     // TODO: Don't bother translators with this nonsense and detect this file automatically.
     //: IMPORTANT: This text has a special meaning, do not translate it directly. This is the file name of translation files for the game engine, found in Data/Locale/. Usually, you replace “en” with the ISO-639-1 language code of your language.
--- a/hedgewars/ArgParsers.pas	Mon May 09 20:11:38 2022 +0300
+++ b/hedgewars/ArgParsers.pas	Mon May 09 23:58:51 2022 +0300
@@ -244,13 +244,13 @@
 end;
 
 function parseParameter(cmd:string; arg:string; var paramIndex:LongInt): Boolean;
-const reallyAll: array[0..35] of shortstring = (
+const reallyAll: array[0..37] of shortstring = (
                 '--prefix', '--user-prefix', '--locale', '--fullscreen-width', '--fullscreen-height', '--width',
                 '--height', '--maximized', '--frame-interval', '--volume','--nomusic', '--nosound', '--nodampen',
                 '--fullscreen', '--showfps', '--altdmg', '--low-quality', '--raw-quality', '--stereo', '--nick',
                 '--zoom',
   {internal}    '--internal', '--port', '--recorder', '--landpreview',
-  {misc}        '--stats-only', '--gci', '--help','--protocol', '--no-teamtag','--no-hogtag','--no-healthtag','--translucent-tags','--lua-test','--no-holiday-silliness','--chat-size');
+  {misc}        '--stats-only', '--gci', '--help','--protocol', '--no-teamtag','--no-hogtag','--no-healthtag','--translucent-tags','--lua-test','--no-holiday-silliness','--chat-size', '--prefix64', '--user-prefix64');
 var cmdIndex: byte;
 begin
     parseParameter:= false;
@@ -299,6 +299,8 @@
         {--lua-test}            33 : begin cTestLua := true; SetSound(false); cScriptName := getstringParameter(arg, paramIndex, parseParameter); WriteLn(stdout, 'Lua test file specified: ' + cScriptName);end;
         {--no-holiday-silliness} 34 : cHolidaySilliness:= false;
         {--chat-size}           35 : cDefaultChatScale := 1.0 * getLongIntParameter(arg, paramIndex, parseParameter) / 100;
+        {--prefix64}            36: PathPrefix := DecodeBase64(getstringParameter(arg, paramIndex, parseParameter));
+        {--user-prefix64}       37: UserPathPrefix := DecodeBase64(getstringParameter(arg, paramIndex, parseParameter));
     else
         begin
         //Assume the first "non parameter" is the demo file, anything else is invalid