Fix for home directory on windoze

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@15142 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2002-11-27 14:56:44 +00:00
parent dd69b3aa52
commit f52211e8b0
2 changed files with 14 additions and 6 deletions

View file

@ -8,6 +8,8 @@
descriptions. descriptions.
Also, honor NSWriteOldStylePropertyLists user default to write old Also, honor NSWriteOldStylePropertyLists user default to write old
style property-lists rather than new style or xml style. style property-lists rather than new style or xml style.
* Source/NSUser.m: Use USERPROFILE for default home directory on
windoze.
2002-11-26 Richard Frith-Macdonald <rfm@gnu.org> 2002-11-26 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -257,14 +257,20 @@ NSHomeDirectoryForUser(NSString *loginName)
#else #else
if ([loginName isEqual: NSUserName()] == YES) if ([loginName isEqual: NSUserName()] == YES)
{ {
/* Then environment variable HOMEPATH holds the home directory
for the user on Windows NT; Win95 has no concept of home. */
[gnustep_global_lock lock]; [gnustep_global_lock lock];
s = GSStringFromWin32EnvironmentVariable("HOMEPATH"); /* The environment variable USERPROFILE holds the home directory
if (s != nil) for the user on more modern versions of windoze. */
s = GSStringFromWin32EnvironmentVariable("USERPROFILE");
if (s == nil)
{ {
s = [GSStringFromWin32EnvironmentVariable("HOMEDRIVE") /* The environment variable HOMEPATH holds the home directory
stringByAppendingString: s]; for the user on Windows NT; Win95 has no concept of home. */
s = GSStringFromWin32EnvironmentVariable("HOMEPATH");
if (s != nil)
{
s = [GSStringFromWin32EnvironmentVariable("HOMEDRIVE")
stringByAppendingString: s];
}
} }
[gnustep_global_lock unlock]; [gnustep_global_lock unlock];
} }