mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
condense separators at start of path.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31875 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
15fd754bf2
commit
cc405b9ed6
2 changed files with 31 additions and 1 deletions
|
@ -4261,7 +4261,30 @@ static NSFileManager *fm = nil;
|
|||
|
||||
caiImp = (unichar (*)())[s methodForSelector: caiSel];
|
||||
|
||||
// Condense multiple separator ('/') sequences.
|
||||
/* Remove any separators ('/') immediately after the trailing
|
||||
* separator in the rot (if any).
|
||||
*/
|
||||
if (root > 0 && YES == pathSepMember((*caiImp)(s, caiSel, root-1)))
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = root; i < l; i++)
|
||||
{
|
||||
if (NO == pathSepMember((*caiImp)(s, caiSel, i)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i > root)
|
||||
{
|
||||
r = (NSRange){root, i-root};
|
||||
[s deleteCharactersInRange: r];
|
||||
l -= r.length;
|
||||
}
|
||||
}
|
||||
|
||||
/* Condense multiple separator ('/') sequences.
|
||||
*/
|
||||
r = (NSRange){root, l-root};
|
||||
while ((r = [s rangeOfCharacterFromSet: pathSeps()
|
||||
options: 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue