mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Tidyups and fix in mingw drive handling
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20911 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7602f504b2
commit
daaa1f5dd7
4 changed files with 32 additions and 6 deletions
|
@ -3586,10 +3586,23 @@ static NSFileManager *fm = nil;
|
|||
first_slash_range = [self rangeOfCharacterFromSet: pathSeps()
|
||||
options: NSLiteralSearch
|
||||
range: ((NSRange){0, length})];
|
||||
if (first_slash_range.length == 0)
|
||||
{
|
||||
first_slash_range.location = length;
|
||||
}
|
||||
|
||||
/*
|
||||
* Anything beginning '~' followed by a single letter is assumed
|
||||
* to be a windows drive specification.
|
||||
*/
|
||||
if (first_slash_range.location == 2 && isalpha([self characterAtIndex: 1]))
|
||||
{
|
||||
return IMMUTABLE(self);
|
||||
}
|
||||
|
||||
if (first_slash_range.location != 1)
|
||||
{
|
||||
/* It is of the form `~username/blah/...' */
|
||||
/* It is of the form `~username/blah/...' or '~username' */
|
||||
int uname_len;
|
||||
NSString *uname;
|
||||
|
||||
|
@ -3608,13 +3621,21 @@ static NSFileManager *fm = nil;
|
|||
}
|
||||
else
|
||||
{
|
||||
/* It is of the form `~/blah/...' */
|
||||
/* It is of the form `~/blah/...' or is '~' */
|
||||
homedir = NSHomeDirectory ();
|
||||
}
|
||||
|
||||
if (homedir != nil)
|
||||
{
|
||||
return [homedir stringByAppendingPathComponent:
|
||||
[self substringFromIndex: first_slash_range.location]];
|
||||
if (first_slash_range.location < length)
|
||||
{
|
||||
return [homedir stringByAppendingPathComponent:
|
||||
[self substringFromIndex: first_slash_range.location]];
|
||||
}
|
||||
else
|
||||
{
|
||||
return IMMUTABLE(homedir);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue