Windows: Fix crash when user.name is not set in git config.

This commit is contained in:
Joey Hess 2014-10-31 16:14:12 -04:00
parent 8c622ec100
commit 0f6aaf8012
5 changed files with 18 additions and 22 deletions

View file

@ -40,11 +40,12 @@ myUserName = myVal env userName
env = ["USERNAME", "USER", "LOGNAME"]
#endif
myUserGecos :: IO String
#ifdef __ANDROID__
myUserGecos = return "" -- userGecos crashes on Android
myUserGecos :: IO (Maybe String)
-- userGecos crashes on Android and is not available on Windows.
#if defined(__ANDROID__) || defined(mingw32_HOST_OS)
myUserGecos = return Nothing
#else
myUserGecos = myVal [] userGecos
myUserGecos = Just <$> myVal [] userGecos
#endif
myVal :: [String] -> (UserEntry -> String) -> IO String