diff options
Diffstat (limited to 'src/CabalHelper/Compiletime/Compat/Environment.hs')
-rw-r--r-- | src/CabalHelper/Compiletime/Compat/Environment.hs | 17 |
1 files changed, 15 insertions, 2 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 |