diff options
Diffstat (limited to 'src/CabalHelper/Compiletime')
-rw-r--r-- | src/CabalHelper/Compiletime/Compat/Environment.hs | 17 | ||||
-rw-r--r-- | src/CabalHelper/Compiletime/Data.hs | 6 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/CabalHelper/Compiletime/Compat/Environment.hs b/src/CabalHelper/Compiletime/Compat/Environment.hs index 916f782..535bcc6 100644 --- a/src/CabalHelper/Compiletime/Compat/Environment.hs +++ b/src/CabalHelper/Compiletime/Compat/Environment.hs @@ -1,6 +1,19 @@ +{-# LANGUAGE CPP #-} module CabalHelper.Compiletime.Compat.Environment where -import System.Environment +import qualified System.Environment +#ifndef mingw32_HOST_OS +import qualified System.Posix.Env (setEnv) +#endif lookupEnv :: String -> IO (Maybe String) -lookupEnv var = do env <- getEnvironment; return (lookup var env) +lookupEnv var = + do env <- System.Environment.getEnvironment + return (lookup var env) + +setEnv :: String -> String -> IO () +#ifdef mingw32_HOST_OS +setEnv = System.Environment.setEnv +#else +setEnv k v = System.Posix.Env.setEnv k v True +#endif diff --git a/src/CabalHelper/Compiletime/Data.hs b/src/CabalHelper/Compiletime/Data.hs index dce3570..ca291e9 100644 --- a/src/CabalHelper/Compiletime/Data.hs +++ b/src/CabalHelper/Compiletime/Data.hs @@ -33,9 +33,9 @@ import Language.Haskell.TH import System.Directory import System.FilePath import System.IO.Temp -import System.Posix.Files -import System.Posix.Time -import System.Posix.Types +import System.PosixCompat.Files +import System.PosixCompat.Time +import System.PosixCompat.Types import Prelude import CabalHelper.Compiletime.Compat.Environment |