make string standardisation more consistent

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37675 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2014-02-03 13:30:46 +00:00
parent e41faab415
commit 1a3698162b
4 changed files with 40 additions and 10 deletions

View file

@ -330,10 +330,12 @@ pathSepMember(unichar c)
return NO;
}
/*
* For cross-platform portability we always use slash as the separator
/* For cross-platform portability we always use slash as the separator
* when building paths ... unless specific windows path handling is
* required.
* This ensures that standardised paths and anything built by adding path
* components to them use a consistent separator character anad can be
* compared readily using standard string comparisons.
*/
inline static unichar
pathSepChar()
@ -4762,14 +4764,20 @@ static NSFileManager *fm = nil;
s = AUTORELEASE([self mutableCopy]);
}
if (GSPathHandlingUnix() == YES)
{
[s replaceString: @"\\" withString: @"/"];
}
else if (GSPathHandlingWindows() == YES)
/* We must always use the standard path separator unless specifically set
* to use the mswindows one. That ensures that standardised paths and
* anything built by adding path components to them use a consistent
* separator character anad can be compared readily using standard string
* comparisons.
*/
if (GSPathHandlingWindows() == YES)
{
[s replaceString: @"/" withString: @"\\"];
}
else
{
[s replaceString: @"\\" withString: @"/"];
}
l = [s length];
root = rootOf(s, l);