mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 12:21:55 +00:00
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:
parent
69277bd2e0
commit
29e5e5ea83
1 changed files with 2 additions and 16 deletions
|
@ -969,7 +969,7 @@ selectCellWithString: (NSString*)title
|
||||||
createRowsForColumn: (int)column
|
createRowsForColumn: (int)column
|
||||||
inMatrix: (NSMatrix*)matrix
|
inMatrix: (NSMatrix*)matrix
|
||||||
{
|
{
|
||||||
NSString *path, *pathTmp, *file, *pathAndFile, *extension, *h;
|
NSString *path, *file, *pathAndFile, *extension, *h;
|
||||||
NSArray *files, *hiddenFiles;
|
NSArray *files, *hiddenFiles;
|
||||||
unsigned i, count, addedRows;
|
unsigned i, count, addedRows;
|
||||||
BOOL exists, isDir;
|
BOOL exists, isDir;
|
||||||
|
@ -981,25 +981,11 @@ createRowsForColumn: (int)column
|
||||||
NSString *progressString = nil;
|
NSString *progressString = nil;
|
||||||
/* We create lot of objects in this method, so we use a pool */
|
/* We create lot of objects in this method, so we use a pool */
|
||||||
NSAutoreleasePool *pool;
|
NSAutoreleasePool *pool;
|
||||||
NSDirectoryEnumerator *dirEnum;
|
|
||||||
IMP nxtImp;
|
|
||||||
IMP addImp;
|
|
||||||
|
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
|
|
||||||
path = [_browser pathToColumn: column];
|
path = [_browser pathToColumn: column];
|
||||||
dirEnum = AUTORELEASE([[NSDirectoryEnumerator alloc]
|
files = [[NSFileManager defaultManager] directoryContentsAtPath: path];
|
||||||
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);
|
|
||||||
|
|
||||||
// Remove hidden files
|
// Remove hidden files
|
||||||
h = [path stringByAppendingPathComponent: @".hidden"];
|
h = [path stringByAppendingPathComponent: @".hidden"];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue