premake-core
premake-core copied to clipboard
Path encoding issues on Windows
It seems the Windows path handling has some discrepancies when paths contain non-ANSI characters.
For instance, when running premake inside a directory with non-ANSI characters, it seems it notices there's a premake-system.lua file, but it can't load it:
C:\a>mkdir á
C:\a>cd á
C:\a\á>notepad premake-system.lua
C:\a\á>premake5.exe
Error: cannot open C:/a/á/premake-system.lua: No such file or directory
but it works when using simple path names:
C:\a>mkdir a
C:\a>cd a
C:\a\a>notepad premake-system.lua
C:\a\a>premake5.exe
Type 'premake5 --help' for help
Another example, checking if a path exists shows some encoding issues:
C:\a\á>premake5.exe --interactive
> print(os.getcwd())
C:/a/á
> print(os.isdir(os.getcwd()))
true
> print(path.getabsolute("../á"))
C:/a/á
> print(os.isdir(path.getabsolute("../á")))
false
and it works well with simple paths:
C:\a\a>premake5.exe --interactive
> print(os.getcwd())
C:/a/a
> print(os.isdir(os.getcwd()))
true
> print(path.getabsolute("../a"))
C:/a/a
> print(os.isdir(path.getabsolute("../a")))
true
Is there anything we can do to fix this issue (other than renaming all our paths? 😄)
Sorry this fell through the cracks, Lua doesn't support Unicode out of the box, so there isn't really anything we can do, as far as I'm aware.
@sp-jordi-vilalta If you are able, can you provide any information on where in the Premake code that path gets mangled? We've been trying to improve the Unicode support, and many of the low-level platform routines work. It would be helpful to know where there are still gaps that need fixing.
Its really sad, because my game engine use premake to generate script project. But problem that engine also allows create projects with no-ASCII, and with Russian characters.
So really one solution that i can see it just generate script project somewhere it different folder when path is clearly not contains Unicode characters, and then just move it back to project itself.