From d0fa82fb721cdc85438287e29a94cb796b7bc464 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 11 May 2013 15:03:00 -0500 Subject: git-annex now builds on Windows (doesn't work) --- Annex/Branch.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'Annex/Branch.hs') diff --git a/Annex/Branch.hs b/Annex/Branch.hs index 3788358f2..8c3fb41f6 100755 --- a/Annex/Branch.hs +++ b/Annex/Branch.hs @@ -24,8 +24,10 @@ module Annex.Branch ( ) where import qualified Data.ByteString.Lazy.Char8 as L -#ifndef mingw32_HOST_OS -import System.Posix.Env +#ifdef __ANDROID__ +import System.Posix.Env (getEnv) +#else +import System.Environment (getEnvironment) #endif import Common.Annex @@ -290,12 +292,14 @@ withIndex' bootstrapping a = do f <- fromRepo gitAnnexIndex g <- gitRepo #ifdef __ANDROID__ - {- Work around for weird getEnvironment breakage on Android. See + {- This should not be necessary on Android, but there is some + - weird getEnvironment breakage. See - https://github.com/neurocyte/ghc-android/issues/7 - - Instead, use getEnv to get some key environment variables that + - Use getEnv to get some key environment variables that - git expects to have. -} let keyenv = words "USER PATH GIT_EXEC_PATH HOSTNAME HOME" - let getEnvPair k = maybe Nothing (\v -> Just (k, v)) <$> getEnv k + let getEnvPair k = maybe Nothing (\v -> Just (k, v)) <$> + catchMaybeIO (getEnv k) e <- liftIO $ catMaybes <$> forM keyenv getEnvPair #else e <- liftIO getEnvironment -- cgit v1.2.3