check addition env vars so it works on Windows outside of Cygwin
This commit is contained in:
parent
73da744680
commit
94c9c983e6
1 changed files with 14 additions and 2 deletions
16
Utility/UserInfo.hs
Normal file → Executable file
16
Utility/UserInfo.hs
Normal file → Executable file
|
@ -22,11 +22,23 @@ import Utility.Env
|
||||||
-
|
-
|
||||||
- getpwent will fail on LDAP or NIS, so use HOME if set. -}
|
- getpwent will fail on LDAP or NIS, so use HOME if set. -}
|
||||||
myHomeDir :: IO FilePath
|
myHomeDir :: IO FilePath
|
||||||
myHomeDir = myVal ["HOME"] homeDirectory
|
myHomeDir = myVal env homeDirectory
|
||||||
|
where
|
||||||
|
#ifndef __WINDOWS__
|
||||||
|
env = ["HOME"]
|
||||||
|
#else
|
||||||
|
env = ["USERPROFILE", "HOME"] -- HOME is used in Cygwin
|
||||||
|
#endif
|
||||||
|
|
||||||
{- Current user's user name. -}
|
{- Current user's user name. -}
|
||||||
myUserName :: IO String
|
myUserName :: IO String
|
||||||
myUserName = myVal ["USER", "LOGNAME"] userName
|
myUserName = myVal env userName
|
||||||
|
where
|
||||||
|
#ifndef __WINDOWS__
|
||||||
|
env = ["USER", "LOGNAME"]
|
||||||
|
#else
|
||||||
|
env = ["USERNAME", "USER", "LOGNAME"]
|
||||||
|
#endif
|
||||||
|
|
||||||
myUserGecos :: IO String
|
myUserGecos :: IO String
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue