Use the public NSFileManager API to enumerate the contents of a directory,

so that the library is not broken when the internals of NSFileManager are
changed


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@9532 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2001-04-06 22:41:55 +00:00
parent 69277bd2e0
commit 29e5e5ea83

View file

@ -969,7 +969,7 @@ selectCellWithString: (NSString*)title
createRowsForColumn: (int)column
inMatrix: (NSMatrix*)matrix
{
NSString *path, *pathTmp, *file, *pathAndFile, *extension, *h;
NSString *path, *file, *pathAndFile, *extension, *h;
NSArray *files, *hiddenFiles;
unsigned i, count, addedRows;
BOOL exists, isDir;
@ -981,25 +981,11 @@ createRowsForColumn: (int)column
NSString *progressString = nil;
/* We create lot of objects in this method, so we use a pool */
NSAutoreleasePool *pool;
NSDirectoryEnumerator *dirEnum;
IMP nxtImp;
IMP addImp;
pool = [NSAutoreleasePool new];
path = [_browser pathToColumn: column];
dirEnum = AUTORELEASE([[NSDirectoryEnumerator alloc]
initWithDirectoryPath: path
recurseIntoSubdirectories: NO
followSymlinks: NO
prefixFiles: NO]);
files = [NSMutableArray arrayWithCapacity: 16];
nxtImp = [dirEnum methodForSelector: @selector(nextObject)];
addImp = [files methodForSelector: @selector(addObject:)];
while ((pathTmp = (*nxtImp)(dirEnum, @selector(nextObject))) != nil)
(*addImp)(files, @selector(addObject:), pathTmp);
files = [[NSFileManager defaultManager] directoryContentsAtPath: path];
// Remove hidden files
h = [path stringByAppendingPathComponent: @".hidden"];