mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
home directory fix
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17289 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
99b9efe01d
commit
6efeed0154
2 changed files with 23 additions and 15 deletions
|
@ -1,6 +1,9 @@
|
||||||
2003-07-22 Richard Frith-Macdonald <rfm@gnu.org>
|
2003-07-22 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Tools/AGSHtml.m: Don't output authors heading if not needed.
|
* Tools/AGSHtml.m: Don't output authors heading if not needed.
|
||||||
|
* Source/NSUser.m: Use HOMEPATH in preference to USERPROFILE for
|
||||||
|
OPENSTEP compatibility and because USERPROFILE generally doesn't
|
||||||
|
work due to the presence of spaces.
|
||||||
|
|
||||||
2003-07-21 Richard Frith-Macdonald <rfm@gnu.org>
|
2003-07-21 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -259,9 +259,25 @@ NSHomeDirectoryForUser(NSString *loginName)
|
||||||
if ([loginName isEqual: NSUserName()] == YES)
|
if ([loginName isEqual: NSUserName()] == YES)
|
||||||
{
|
{
|
||||||
[gnustep_global_lock lock];
|
[gnustep_global_lock lock];
|
||||||
/* The environment variable USERPROFILE holds the home directory
|
/*
|
||||||
for the user on more modern versions of windoze. */
|
* The environment variable HOMEPATH holds the home directory
|
||||||
s = GSStringFromWin32EnvironmentVariable("USERPROFILE");
|
* for the user on Windows NT; Win95 has no concept of home.
|
||||||
|
* For OPENSTEP compatibility (and because USERPROFILE is usually
|
||||||
|
* unusable because it contains spaces), we use HOMEPATH in
|
||||||
|
* preference to USERPROFILE.
|
||||||
|
*/
|
||||||
|
s = GSStringFromWin32EnvironmentVariable("HOMEPATH");
|
||||||
|
if (s != nil && ([s length] < 2 || [s characterAtIndex: 1] != ':'))
|
||||||
|
{
|
||||||
|
s = [GSStringFromWin32EnvironmentVariable("HOMEDRIVE")
|
||||||
|
stringByAppendingString: s];
|
||||||
|
}
|
||||||
|
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)
|
if (s != nil)
|
||||||
{
|
{
|
||||||
const char *str = [s cString];
|
const char *str = [s cString];
|
||||||
|
@ -270,23 +286,12 @@ NSHomeDirectoryForUser(NSString *loginName)
|
||||||
{
|
{
|
||||||
if (isspace(*str))
|
if (isspace(*str))
|
||||||
{
|
{
|
||||||
s = nil; // Whitespace not permitted in USERPROFILE
|
s = nil; // Whitespace not permitted in home directory
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
str++;
|
str++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (s == nil)
|
|
||||||
{
|
|
||||||
/* 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 length] < 2 || [s characterAtIndex: 1] != ':'))
|
|
||||||
{
|
|
||||||
s = [GSStringFromWin32EnvironmentVariable("HOMEDRIVE")
|
|
||||||
stringByAppendingString: s];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
[gnustep_global_lock unlock];
|
[gnustep_global_lock unlock];
|
||||||
}
|
}
|
||||||
if ([s length] == 0 && [loginName length] != 1)
|
if ([s length] == 0 && [loginName length] != 1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue