From f7b8cc8963cce405cb5dbda02ba58dec67b75657 Mon Sep 17 00:00:00 2001 From: Marek Fajkus Date: Sun, 19 May 2019 22:19:18 +0200 Subject: [PATCH] fix toNixPath --- src/Elm2Nix.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Elm2Nix.hs b/src/Elm2Nix.hs index 6d8659c..f29587a 100644 --- a/src/Elm2Nix.hs +++ b/src/Elm2Nix.hs @@ -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