[commit: packages/filepath] master: Change the generator to write a file with Unix line endings on all platforms (1580b35)

git at git.haskell.org git at git.haskell.org
Thu Mar 19 11:36:11 UTC 2015


Repository : ssh://git@git.haskell.org/filepath

On branch  : master
Link       : http://git.haskell.org/packages/filepath.git/commitdiff/1580b35105a819f8127ce66bd9947532980ab678

>---------------------------------------------------------------

commit 1580b35105a819f8127ce66bd9947532980ab678
Author: Neil Mitchell <ndmitchell at gmail.com>
Date:   Wed Oct 29 08:02:59 2014 +0000

    Change the generator to write a file with Unix line endings on all platforms


>---------------------------------------------------------------

1580b35105a819f8127ce66bd9947532980ab678
 Generate.hs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Generate.hs b/Generate.hs
index 53ec8c6..7f956e7 100755
--- a/Generate.hs
+++ b/Generate.hs
@@ -16,7 +16,7 @@ isExpr _ = False
 
 main = do src <- readFile "System/FilePath/Internal.hs"
           let tests = concatMap getTest $ zip [1..] (lines src)
-          writeFile "tests/FilePath_Test.hs" (prefix ++ genTests tests)
+          writeFileBinary "tests/FilePath_Test.hs" (prefix ++ genTests tests)
 
 prefix = unlines
     ["import AutoTest"
@@ -107,3 +107,6 @@ genTest (Test free x) = "quickSafe (\\" ++ concatMap ((' ':) . f) free ++ " -> (
     where
         f [a] | a >= 'x' = "(QFilePath " ++ [a] ++ ")"
         f x = x
+
+writeFileBinary :: FilePath -> String -> IO ()
+writeFileBinary file x = withBinaryFile file WriteMode $ \h -> hPutStr h x



More information about the ghc-commits mailing list