mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +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
|
@ -1,3 +1,10 @@
|
|||
2011-01-11 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSString.m: ([-stringByStandardizingPath:]) Fix bug when
|
||||
dealing with three or more separators at the start of a path ...
|
||||
should condense them to a single separator. Thanks to Robert Slover
|
||||
for pointing this out.
|
||||
|
||||
2011-01-10 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* configure: regenerate
|
||||
|
|
|
@ -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…
Reference in a new issue