ianmackenzie / ianmackenzie/elm-script

Add Script.Environment.elmHome

Open
#22 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Elm
Stars
34
Forks
5
PR merge metrics
No merged PRs in 30d

Description

I think the following would be a useful helper function to have once https://github.com/ianmackenzie/elm-script/issues/21 is solved.
```
elmHome : Script.Init -> String
elmHome init =
let
default =
case init.platform of
Script.Platform.Posix _ ->
"~/.elm/"

Script.Platform.Windows ->
"%appdata%/elm/"
in
Script.Environment.get "ELM_HOME" init.environment |> Maybe.withDefault default
```

That said, I'm not sure if it's expected for filepaths to have a trailing `/` or not. It might be better if there was a Path datastructure exposed that would let you safely create and combine paths without risking getting something like `"~/.elm/" ++ "/test" == "~/.elm//test"`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.