diff --git a/src/Goldplate.hs b/src/Goldplate.hs index 6b36484..cf2d409 100644 --- a/src/Goldplate.hs +++ b/src/Goldplate.hs @@ -230,7 +230,7 @@ specExecutions specPath spec = do inputFiles <- Dir.withCurrentDirectory workDirectory $ do matches <- globCurrentDir glob length matches `seq` return matches - return (map (Just . FP.normalise) inputFiles) + return (map (Just . normalise) inputFiles) -- Create an execution for every concrete input. forM concreteInputFiles $ \mbInputFile -> do @@ -257,6 +257,15 @@ specExecutions specPath spec = do hoistEither :: Either MissingEnvVar a -> IO a hoistEither = either throwIO return + -- A version of FP.normalise that uses slash as 'pathSeparator' even under Windows. + -- Drops "." directories in the path. + -- Should make test outputs that contain filepaths more portable. + -- Assumes that the argument is a file rather than a directory. + -- This frees us from corner cases such as "." and "./". + normalise :: FilePath -> FilePath + normalise = List.intercalate "/" . dropDots . FP.splitDirectories + where + dropDots = filter ("." /=) executionHeader :: Execution -> String executionHeader execution =