diff options
author | 2013-12-19 02:37:21 -0400 | |
---|---|---|
committer | 2013-12-19 02:37:21 -0400 | |
commit | 665321a1f148608655648c13958b1cc3e8edabd9 (patch) | |
tree | 35e956af90d86c656f062d0186fe0f33ff19d5d6 /Build/EvilSplicer.hs | |
parent | 02236e8038cef35123c22c4b2c4691065ccf902c (diff) |
avoid EvilSplicer crashing on encoding problems, including LANG=C with utf-8 in files
Diffstat (limited to 'Build/EvilSplicer.hs')
-rw-r--r-- | Build/EvilSplicer.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Build/EvilSplicer.hs b/Build/EvilSplicer.hs index 63edc86b9..47402b522 100644 --- a/Build/EvilSplicer.hs +++ b/Build/EvilSplicer.hs @@ -199,10 +199,10 @@ applySplices :: FilePath -> Maybe String -> [Splice] -> IO () applySplices destdir imports splices@(first:_) = do let f = splicedFile first let dest = (destdir </> f) - lls <- map (++ "\n") . lines <$> readFileStrict f + lls <- map (++ "\n") . lines <$> readFileStrictAnyEncoding f createDirectoryIfMissing True (parentDir dest) let newcontent = concat $ addimports $ expand lls splices - oldcontent <- catchMaybeIO $ readFileStrict dest + oldcontent <- catchMaybeIO $ readFileStrictAnyEncoding dest when (oldcontent /= Just newcontent) $ do putStrLn $ "splicing " ++ f writeFile dest newcontent |