GFixed recursion bug.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4451 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-06-21 18:40:08 +00:00
parent 78a3abc069
commit 4a690610ec
3 changed files with 22 additions and 21 deletions

View file

@ -1,6 +1,7 @@
Mon Jun 21 12:05:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
Mon Jun 21 20:55:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSFileManager.m: Fixed error recursing into directory.
* Source/include/NSFileManager.h: tidied.
Mon Jun 21 9:45:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>

View file

@ -130,7 +130,6 @@
struct {
BOOL isRecursive: 1;
BOOL isFollowing: 1;
BOOL shouldSkip: 1;
} flags;
}

View file

@ -1193,7 +1193,6 @@ static NSFileManager* defaultManager = nil;
DESTROY(currentFileName);
DESTROY(currentFilePath);
DESTROY(fileAttributes);
flags.shouldSkip = NO;
}
/*
@ -1240,24 +1239,27 @@ static NSFileManager* defaultManager = nil;
stringByAppendingPathComponent: currentFileName]);
// Check if directory
cpath = [manager fileSystemRepresentationWithPath: currentFilePath];
// Do not follow links
if (!flags.isFollowing)
if (flags.isRecursive == YES)
{
if (lstat(cpath, &statbuf) != 0)
break;
// If link then return it as link
if (S_IFLNK == (S_IFMT & statbuf.st_mode))
break;
}
else
{
if (stat(cpath, &statbuf) != 0)
break;
}
if (S_IFDIR == (S_IFMT & statbuf.st_mode))
{
[self recurseIntoDirectory: currentFilePath
relativeName: currentFileName];
// Do not follow links
if (!flags.isFollowing)
{
if (lstat(cpath, &statbuf) != 0)
break;
// If link then return it as link
if (S_IFLNK == (S_IFMT & statbuf.st_mode))
break;
}
else
{
if (stat(cpath, &statbuf) != 0)
break;
}
if (S_IFDIR == (S_IFMT & statbuf.st_mode))
{
[self recurseIntoDirectory: currentFilePath
relativeName: currentFileName];
}
}
break; // Got a file name - break out of loop
}
@ -1266,7 +1268,6 @@ static NSFileManager* defaultManager = nil;
[self backtrack];
}
}
flags.shouldSkip = NO;
}
// Initializing