Skip to content

Commit

Permalink
fix toNixPath
Browse files Browse the repository at this point in the history
  • Loading branch information
turboMaCk committed May 19, 2019
1 parent 39bb9d4 commit ce64e0f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Elm2Nix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,15 @@ parseElmJsonSrcs obj =
extractSrcPath :: Value -> Either Elm2NixError String
extractSrcPath val =
case val of
String text -> Right $ toNixPath text
String text -> Right (toNixPath (Text.unpack text))
v -> Left $ UnexpectedValue v

toNixPath :: Text -> String
toNixPath = (\p -> if p == "." then "./." else p ) . Text.unpack
toNixPath :: FilePath -> FilePath
toNixPath path =
case path of
"." -> "./."
p@('.':_) -> p
p -> "./" <> p

-- CMDs

Expand Down

0 comments on commit ce64e0f

Please sign in to comment.