summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/GF/Infra/UseIO.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/compiler/GF/Infra/UseIO.hs b/src/compiler/GF/Infra/UseIO.hs
index 72875f70d..1240351f6 100644
--- a/src/compiler/GF/Infra/UseIO.hs
+++ b/src/compiler/GF/Infra/UseIO.hs
@@ -186,6 +186,8 @@ putPointE v opts msg act = do
return a
+-- * File IO
+
writeUTF8File :: FilePath -> String -> IO ()
writeUTF8File fpath content = do
h <- openFile fpath WriteMode
@@ -193,6 +195,9 @@ writeUTF8File fpath content = do
hPutStr h content
hClose h
+readBinaryFile path = hGetContents =<< openBinaryFile path ReadMode
+writeBinaryFile path s = withBinaryFile path WriteMode (flip hPutStr s)
+
-- * Functions to limit acesss to arbitrary IO and system commands
restricted io =
either (const io) (const $ fail message) =<< try (getEnv "GF_RESTRICTED")