premake-core icon indicating copy to clipboard operation
premake-core copied to clipboard

Path encoding issues on Windows

Open sp-jordi-vilalta opened this issue 6 years ago • 3 comments

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? 😄)

sp-jordi-vilalta avatar Aug 30 '18 09:08 sp-jordi-vilalta