mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 08:26:27 +00:00
fix NSHomeDirectory() to return more useful value on Windows
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30102 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9e9b30672a
commit
a3a7e0f167
2 changed files with 12 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
2010-04-07 Doug Simons <doug.simons@testplant.com>
|
||||
|
||||
* Source/NSPathUtilities.m: Prefer USERPROFILE for the
|
||||
NSHomeDirectory() on Windows if HOMEPATH is set to '\'.
|
||||
|
||||
2010-04-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* configure.ac: Fix for bug #29291 based on suggestion by Niels Grewe
|
||||
|
|
|
@ -1445,10 +1445,15 @@ NSHomeDirectoryForUser(NSString *loginName)
|
|||
* for the user on Windows NT;
|
||||
* For OPENSTEP compatibility (and because USERPROFILE is usually
|
||||
* unusable because it contains spaces), we use HOMEPATH in
|
||||
* preference to USERPROFILE.
|
||||
* preference to USERPROFILE, except when MINGW has set HOMEPATH to '\'
|
||||
* which isn't very useful, so we prefer USERPROFILE in that case.
|
||||
*/
|
||||
s = [e objectForKey: @"HOMEPATH"];
|
||||
if (s != nil && ([s length] < 2 || [s characterAtIndex: 1] != ':'))
|
||||
if ([s isEqualToString:@"\\"] && [e objectForKey: @"USERPROFILE"] != nil)
|
||||
{
|
||||
s = [e objectForKey: @"USERPROFILE"];
|
||||
}
|
||||
else if (s != nil && ([s length] < 2 || [s characterAtIndex: 1] != ':'))
|
||||
{
|
||||
s = [[e objectForKey: @"HOMEDRIVE"] stringByAppendingString: s];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue