haxe
haxe copied to clipboard
[CPP] `Sys.getCwd()` returns wrong path if the path contains non-ascii chars
Following this openfl/lime/issues/1757 issue, I though I found a workaround, but it didn't work for cpp.
So, Lime structures get incorrect path to assets and the app crashes. Using Sys.getCwd() to get the correct path worked for my case only on HL. Trying it on cpp I still get the crash - non-ascii path results with wrong string returned by Sys.getCwd().
trace(Sys.getCwd());
what it should be
C:\game\export\windows\я\
but it is
C:\game\export\windows\╤П\
As was stated in similar issue #10859, tediously telling the users how to "properly start" the app is annoying.
Are you sure the problem is with Sys.getCwd()? I've run into similar issues where the strings returned from system functions were correct, but they were printed incorrectly:
https://github.com/HaxeFoundation/hxcpp/pull/880
Maybe test:
trace("C:\\game\\export\\windows\\я\\");
trace(Sys.getCwd());
trace(Sys.getCwd() == "C:\\game\\export\\windows\\я\\");
Thanks for pointing this. Indeed comparison (slightly changed though) returns true
trace("C:\\game\\export\\windows\\я");
trace(Sys.getCwd());
trace(Sys.getCwd() == "C:\\game\\export\\windows\\я/");
src/Main.hx:15: C:\game\export\windows\С'
src/Main.hx:16: C:\game\export\windows\С'/
src/Main.hx:17: true
I will do more tests with Lime then.