mdgriffith / elm-codegen

https://package.elm-lang.org/packages/mdgriffith/elm-codegen/latest/
BSD 3-Clause "New" or "Revised" License
137 stars 16 forks source link

Non-portable path in `elm.codegen.json` codegen-helpers.local. #59

Open mdrie opened 1 year ago

mdrie commented 1 year ago

When running

elm-codegen init

on Windows, everything works fine. It generates a path with correctly escaped backslashes into elm.codegen.json.

However, when a Unix-style path are included (E.g. change in the generated file codegen\\helpers\\ to codegen/helpers/), the path is silently ignored.

This can be seen by deleting codegen/Gen and running elm-codegen install. After that, codegen/Gen/Helper.elm is missing.

The main issue is: On Windows, a path like codegen/helpers/ should be interpreted as codegen\\helpers\\.

Less important: elm-codegen init should write codegen/helpers/ into elm.codegen.json.

This issue was discovered together with @dillonkearns.

dillonkearns commented 1 year ago

I've run into Windows path issues like this in Node. In the past, the fix for me has been to make changes like

someFilePath.split('/') -> someFilePath.split(path.sep)