diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-12-24 15:14:05 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-12-24 15:14:05 -0400 |
| commit | 44bf67b7a2da75ef80e32d6409cc41a6ab8b6ffe (patch) | |
| tree | d955382901fd4ea2bec6412d5b652d9ac7ecbe23 /src/Utility/Misc.hs | |
| parent | fa974cfaaac31b25ae911b5e970507d0589e567b (diff) | |
GHC's fileSystemEncoding is used for all String IO, to avoid encoding-related crashes in eg, Propellor.Property.File.
Diffstat (limited to 'src/Utility/Misc.hs')
| -rw-r--r-- | src/Utility/Misc.hs | 17 |
1 files changed, 0 insertions, 17 deletions
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. - |
