-
-
Notifications
You must be signed in to change notification settings - Fork 417
Description
When using the save file dialogue on non-Windows systems, any non-ASCII characters in the file name result in an invalid string. This is because the string is returned as a wstring: https://github.com/openfl/lime/blob/develop/project/src/ExternalInterface.cpp#L902
While this works fine on Windows, this is problematic on Linux where wstring is not standard. As a result, if the string ends up being passed to hxcpp's system functions, it is considered invalid and we end up with confusing error messages (like Allocating from a GC-free thread which comes from a failed allocation of an exception string to describe this issue).
It's possible to workaround this issue by adding an extra conversion back to a regular string: develop...tobil4sk:lime:74eefc47a480f8055796310f8f3cd770a00b7b16
However, it would probably be better to refactor the api a bit to remove the need for wstring on non Windows systems altogether, because right now there are redundant conversions between string types just to fit this api:
Conversion to wstring:
lime/project/src/ExternalInterface.cpp
Lines 748 to 750 in d75b9f9
| std::wstring* _title = hxstring_to_wstring (title); | |
| std::wstring* _filter = hxstring_to_wstring (filter); | |
| std::wstring* _defaultPath = hxstring_to_wstring (defaultPath); |
Conversion from wstring to string:
lime/project/src/ui/FileDialog.cpp
Lines 108 to 110 in d75b9f9
| std::string* _title = wstring_to_string (title); | |
| std::string* _filter = wstring_to_string (filter); | |
| std::string* _defaultPath = wstring_to_string (defaultPath); |