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:
Richard Frith-Macdonald 2002-11-27 14:56:44 +00:00
parent 92963d25d1
commit ec82855b5b
2 changed files with 14 additions and 6 deletions

View file

@ -8,6 +8,8 @@
descriptions.
Also, honor NSWriteOldStylePropertyLists user default to write old
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>

View file

@ -257,14 +257,20 @@ NSHomeDirectoryForUser(NSString *loginName)
#else
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];
s = GSStringFromWin32EnvironmentVariable("HOMEPATH");
if (s != nil)
/* The environment variable USERPROFILE holds the home directory
for the user on more modern versions of windoze. */
s = GSStringFromWin32EnvironmentVariable("USERPROFILE");
if (s == nil)
{
s = [GSStringFromWin32EnvironmentVariable("HOMEDRIVE")
stringByAppendingString: s];
/* The environment variable HOMEPATH holds the home directory
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];
}