elixir_make icon indicating copy to clipboard operation
elixir_make copied to clipboard

On Windows provide environment variables containing paths with backslashes instead of forward slashes

Open E14 opened this issue 4 years ago ā€¢ 7 comments

It would be beneficial for windows build tools (alright, I mean just nmake) to get Windows-compatible environment variables.

For example ERTS_INCLUDE_DIR in nmake resolves to c:/Program Files/erl10.3/erts-10.3/include instead of c:\Program Files\erl10.3\erts-10.3\include.

While the compiler and nmake itself can deal with that, other tools like copy can't and throw an error. This is especially important on Windows and nmake as useful tools like tr are not available by default and nmake itself is quite limited in features.

Since by now probably some number of projects have worked around that in some way or other, it may also be an option to define additional variables with backslashes, so maintainers have the option to use back- or forward slashes depending on their requirements.

E14 avatar Oct 05 '20 20:10 E14

@E14 I'm not quite sure what you're suggesting to do in this library. Can you clarify that?

whatyouhide avatar Oct 07 '20 15:10 whatyouhide

The library suggests nmake as a default build tool, set here:

  • https://github.com/elixir-lang/elixir_make/blob/master/lib/mix/tasks/compile.make.ex#L246

The library defines environment variables (I think) here:

  • https://github.com/elixir-lang/elixir_make/blob/master/lib/mix/tasks/compile.make.ex#L287

Within the beam, using forward slashes is fine, since Elixir itself is cross-platform. But build tools are platform-specific, so it would be the responsibility of this library and not Elixir itself to translate the environment appropriately as it "leaves" the beam.

E14 avatar Oct 07 '20 19:10 E14

Okay, I see. @josevalim I thought Path.join/2 would use backslashes if needed, that's not the case Iā€™m guessing? #lazyweb

whatyouhide avatar Oct 08 '20 16:10 whatyouhide

Path.join always uses Unix separator, even on Windows. They are converted to \\ at the OS integration level inside the VM. We should probably define some _WINDOWS variables if the OS is Windows with those paths converted.

josevalim avatar Oct 08 '20 17:10 josevalim

Awesome! @E14 would you be willing to send a PR? šŸ˜Š

whatyouhide avatar Oct 30 '20 09:10 whatyouhide

Awesome! @E14 would you be willing to send a PR? šŸ˜Š

I haven't patched this yet as I used a workaround to make the build work with Unix paths. I can create one, but I'm very busy at work currently and Elixir is still personal time for me, so if you have a release coming up, I can't promise you I can make it

E14 avatar Oct 30 '20 10:10 E14

No release coming up and I'm also swamped at work, so take your time šŸ˜„ If I get to this at some point, I'll make sure to bring that up here

whatyouhide avatar Oct 30 '20 10:10 whatyouhide

Closing this for now. If this is tripping someone, a PR is welcome!

josevalim avatar Aug 17 '22 11:08 josevalim