From 44bf67b7a2da75ef80e32d6409cc41a6ab8b6ffe Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 24 Dec 2016 15:14:05 -0400 Subject: GHC's fileSystemEncoding is used for all String IO, to avoid encoding-related crashes in eg, Propellor.Property.File. --- src/Utility/Misc.hs | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'src/Utility/Misc.hs') diff --git a/src/Utility/Misc.hs b/src/Utility/Misc.hs index ebb42576..4498c0a0 100644 --- a/src/Utility/Misc.hs +++ b/src/Utility/Misc.hs @@ -10,9 +10,6 @@ module Utility.Misc where -import Utility.FileSystemEncoding -import Utility.Monad - import System.IO import Control.Monad import Foreign @@ -35,20 +32,6 @@ hGetContentsStrict = hGetContents >=> \s -> length s `seq` return s readFileStrict :: FilePath -> IO String readFileStrict = readFile >=> \s -> length s `seq` return s -{- Reads a file strictly, and using the FileSystemEncoding, so it will - - never crash on a badly encoded file. -} -readFileStrictAnyEncoding :: FilePath -> IO String -readFileStrictAnyEncoding f = withFile f ReadMode $ \h -> do - fileEncoding h - hClose h `after` hGetContentsStrict h - -{- Writes a file, using the FileSystemEncoding so it will never crash - - on a badly encoded content string. -} -writeFileAnyEncoding :: FilePath -> String -> IO () -writeFileAnyEncoding f content = withFile f WriteMode $ \h -> do - fileEncoding h - hPutStr h content - {- Like break, but the item matching the condition is not included - in the second result list. - -- cgit v1.2.3