mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Permit appending path components bewginning with '~'
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24522 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0db5f6bd6d
commit
46e896599b
2 changed files with 21 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
2007-02-13 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSString.m: Don't treat leading '~' in path component or
|
||||
extension as a root when appending that component or extension.
|
||||
|
||||
2007-02-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSException.m: Only initialise modLock where stack module
|
||||
|
|
|
@ -3090,9 +3090,21 @@ static NSFileManager *fm = nil;
|
|||
unsigned originalLength = [self length];
|
||||
unsigned length = originalLength;
|
||||
unsigned aLength = [aString length];
|
||||
unsigned root = rootOf(aString, aLength);
|
||||
unsigned root;
|
||||
unichar buf[length+aLength+1];
|
||||
|
||||
/* If the 'component' has a leading path separator (or drive spec
|
||||
* in windows) then we need to find its length so we can strip it.
|
||||
*/
|
||||
if (aLength > 0 && [aString characterAtIndex: 0] != '~')
|
||||
{
|
||||
root = rootOf(aString, aLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
root = 0;
|
||||
}
|
||||
|
||||
if (length == 0)
|
||||
{
|
||||
[aString getCharacters: buf range: ((NSRange){0, aLength})];
|
||||
|
@ -3195,11 +3207,11 @@ static NSFileManager *fm = nil;
|
|||
}
|
||||
|
||||
/* MacOS-X prohibits an extension beginning with a path separator,
|
||||
* but this code extends that a little to prohibit any root from
|
||||
* being used as an extension. Perhaps we should be more permissive?
|
||||
* but this code extends that a little to prohibit any root except
|
||||
* one beginning with '~' from being used as an extension.
|
||||
*/
|
||||
root = rootOf(aString, [aString length]);
|
||||
if (root > 0)
|
||||
if (root > 0 && [aString characterAtIndex: 0] != '~')
|
||||
{
|
||||
NSLog(@"[%@-%@] cannot append extension '%@' to path '%@'",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd),
|
||||
|
|
Loading…
Reference in a new issue