diff options
author | Joey Hess <joey@kitenet.net> | 2013-12-27 00:10:04 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-12-27 00:10:04 -0400 |
commit | 501bf5ca9c5526baa2a3a5f6c0c4aa19508ec967 (patch) | |
tree | be5fb37d6b6d029db7c15b37355c702d19c704b1 /Build | |
parent | d56ac258e654c8c3668993e81050db2f319517a5 (diff) |
avoid another encoding crash
Diffstat (limited to 'Build')
-rw-r--r-- | Build/EvilSplicer.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Build/EvilSplicer.hs b/Build/EvilSplicer.hs index b5eb5173d..a7120f24f 100644 --- a/Build/EvilSplicer.hs +++ b/Build/EvilSplicer.hs @@ -40,6 +40,7 @@ import Data.Char import System.Environment import System.FilePath import System.Directory +import System.IO import Control.Monad import Prelude hiding (log) @@ -47,6 +48,7 @@ import Utility.Monad import Utility.Misc import Utility.Exception import Utility.Path +import Utility.FileSystemEncoding data Coord = Coord { coordLine :: Int @@ -207,7 +209,10 @@ applySplices destdir imports splices@(first:_) = do oldcontent <- catchMaybeIO $ readFileStrictAnyEncoding dest when (oldcontent /= Just newcontent) $ do putStrLn $ "splicing " ++ f - writeFile dest newcontent + withFile dest WriteMode $ \h -> do + fileEncoding h + hPutStr h newcontent + hClose h where expand lls [] = lls expand lls (s:rest) |