diff options
author | Vladislav Shtepin <anrock623@gmail.com> | 2017-11-03 22:40:37 +0300 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2017-11-07 13:34:40 +0100 |
commit | eb178a5ba4c9432e951b6c206f8baf21257ecb28 (patch) | |
tree | 8889b98f1129ad9034ab71aacfb6988c0b53cf84 /src/CabalHelper/Compiletime/Compat | |
parent | b6ebb3588358ee1bbd4b2cc114aa6650d14baaff (diff) |
Fix windows build using unix-compat
Diffstat (limited to 'src/CabalHelper/Compiletime/Compat')
-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 |