diff options
author | Joey Hess <id@joeyh.name> | 2013-05-11 15:03:00 -0500 |
---|---|---|
committer | Joey Hess <id@joeyh.name> | 2013-05-11 15:03:00 -0500 |
commit | d0fa82fb721cdc85438287e29a94cb796b7bc464 (patch) | |
tree | 26a2486b8e715b5937ce41679eafd42c02f2310a /Utility/UserInfo.hs | |
parent | 679eaf6077375c5d59501d12c79e0891cbdd904f (diff) |
git-annex now builds on Windows (doesn't work)
Diffstat (limited to 'Utility/UserInfo.hs')
-rwxr-xr-x | Utility/UserInfo.hs | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/Utility/UserInfo.hs b/Utility/UserInfo.hs index c0925ecb8..9781f584e 100755 --- a/Utility/UserInfo.hs +++ b/Utility/UserInfo.hs @@ -14,45 +14,31 @@ module Utility.UserInfo ( ) where import Control.Applicative -#ifndef mingw32_HOST_OS -import System.Posix.User -import System.Posix.Env -#endif +import System.Posix.Types +import System.PosixCompat + +import Utility.Env {- Current user's home directory. - - getpwent will fail on LDAP or NIS, so use HOME if set. -} myHomeDir :: IO FilePath -#ifndef mingw32_HOST_OS myHomeDir = myVal ["HOME"] homeDirectory -#else -myHomeDir = error "myHomeDir TODO" -#endif {- Current user's user name. -} myUserName :: IO String -#ifndef mingw32_HOST_OS myUserName = myVal ["USER", "LOGNAME"] userName -#else -myUserName = error "myUserName TODO" -#endif myUserGecos :: IO String #ifdef __ANDROID__ myUserGecos = return "" -- userGecos crashes on Android #else -#ifndef mingw32_HOST_OS myUserGecos = myVal [] userGecos -#else -myUserGecos = error "myUserGecos TODO" -#endif #endif -#ifndef mingw32_HOST_OS myVal :: [String] -> (UserEntry -> String) -> IO String myVal envvars extract = maybe (extract <$> getpwent) return =<< check envvars where check [] = return Nothing check (v:vs) = maybe (check vs) (return . Just) =<< getEnv v getpwent = getUserEntryForID =<< getEffectiveUserID -#endif |