diff options
author | Max Bolingbroke <batterseapower@hotmail.com> | 2011-11-18 17:49:04 +0000 |
---|---|---|
committer | Max Bolingbroke <batterseapower@hotmail.com> | 2011-11-18 17:50:24 +0000 |
commit | c01a23d3e8ad3c9bd3a6fa864ec3d2c8f593906d (patch) | |
tree | 4bbc1f30496f64c4f89df34318b7ca5c41f391c0 | |
parent | ccfbfdaf316506c9b378427d2bc5b19b67a1c0b4 (diff) | |
download | haskell-c01a23d3e8ad3c9bd3a6fa864ec3d2c8f593906d.tar.gz |
Update for a mutable localeEncoding
-rw-r--r-- | compiler/ghci/ObjLink.lhs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/compiler/ghci/ObjLink.lhs b/compiler/ghci/ObjLink.lhs index ea644b9d90..f467c7ada3 100644 --- a/compiler/ghci/ObjLink.lhs +++ b/compiler/ghci/ObjLink.lhs @@ -36,7 +36,11 @@ import Control.Monad ( when ) import Foreign.C import Foreign ( nullPtr ) import GHC.Exts ( Ptr(..) ) -import GHC.IO.Encoding ( fileSystemEncoding ) +#if __GLASGOW_HASKELL__ >= 703 +import GHC.IO.Encoding (getFileSystemEncoding) +#else +import GHC.IO.Encoding (TextEncoding, fileSystemEncoding) +#endif import qualified GHC.Foreign as GHC import System.FilePath ( dropExtension ) @@ -45,9 +49,16 @@ import System.FilePath ( dropExtension ) -- RTS Linker Interface -- --------------------------------------------------------------------------- +#if __GLASGOW_HASKELL__ < 703 +getFileSystemEncoding :: IO TextEncoding +getFileSystemEncoding = return fileSystemEncoding +#endif + -- UNICODE FIXME: Unicode object/archive/DLL file names on Windows will only work in the right code page withFileCString :: FilePath -> (CString -> IO a) -> IO a -withFileCString = GHC.withCString fileSystemEncoding +withFileCString fp f = do + enc <- getFileSystemEncoding + GHC.withCString enc fp f insertSymbol :: String -> String -> Ptr a -> IO () insertSymbol obj_name key symbol |