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 | |
parent | b6ebb3588358ee1bbd4b2cc114aa6650d14baaff (diff) |
Fix windows build using unix-compat
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 |