diff options
Diffstat (limited to 'src/compiler/GFC.hs')
| -rw-r--r-- | src/compiler/GFC.hs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/compiler/GFC.hs b/src/compiler/GFC.hs index 8037d4f1a..1f0ac870b 100644 --- a/src/compiler/GFC.hs +++ b/src/compiler/GFC.hs @@ -17,6 +17,7 @@ import Data.Maybe import Data.Binary import System.FilePath import System.IO +import Control.Exception mainGFC :: Options -> [FilePath] -> IOE () @@ -81,8 +82,8 @@ writeOutput opts file str = do let path = case flag optOutputDir opts of Nothing -> file Just dir -> dir </> file - writeOutputFile opts path str - -writeOutputFile :: Options -> FilePath -> String -> IOE () -writeOutputFile opts outfile output = - do putPointE Normal opts ("Writing " ++ outfile ++ "...") $ ioeIO $ writeFile outfile output + putPointE Normal opts ("Writing " ++ path ++ "...") $ ioeIO $ + bracket + (openFile path WriteMode) + (hClose) + (\h -> hSetEncoding h utf8 >> hPutStr h str) |
