Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CPP] Sys.getCwd() returns wrong path if the path contains non-ascii chars #11552

Open
T1mL3arn opened this issue Feb 6, 2024 · 2 comments
Open

Comments

@T1mL3arn
Copy link
Contributor

T1mL3arn commented Feb 6, 2024

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.

@tobil4sk
Copy link
Member

tobil4sk commented Feb 6, 2024

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:

HaxeFoundation/hxcpp#880

Maybe test:

trace("C:\\game\\export\\windows\\я\\");
trace(Sys.getCwd());
trace(Sys.getCwd() == "C:\\game\\export\\windows\\я\\");

@T1mL3arn
Copy link
Contributor Author

T1mL3arn commented Feb 6, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants