mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
tweak retain/relase of directory
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36323 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
cd890161d2
commit
6037f25342
1 changed files with 28 additions and 27 deletions
|
@ -2340,42 +2340,43 @@ static inline void gsedRelease(GSEnumeratedDirectory X)
|
||||||
justContents: (BOOL)justContents
|
justContents: (BOOL)justContents
|
||||||
for: (NSFileManager*)mgr
|
for: (NSFileManager*)mgr
|
||||||
{
|
{
|
||||||
//TODO: the justContents flag is currently basically useless and should be
|
if (nil != (self = [super init]))
|
||||||
// removed
|
{
|
||||||
_DIR *dir_pointer;
|
//TODO: the justContents flag is currently basically useless and should be
|
||||||
const _CHAR *localPath;
|
// removed
|
||||||
|
_DIR *dir_pointer;
|
||||||
|
const _CHAR *localPath;
|
||||||
|
|
||||||
self = [super init];
|
_mgr = RETAIN(mgr);
|
||||||
|
|
||||||
_mgr = RETAIN(mgr);
|
|
||||||
#if GS_WITH_GC
|
#if GS_WITH_GC
|
||||||
_stack = NSAllocateCollectable(sizeof(GSIArray_t), NSScannedOption);
|
_stack = NSAllocateCollectable(sizeof(GSIArray_t), NSScannedOption);
|
||||||
#else
|
#else
|
||||||
_stack = NSZoneMalloc([self zone], sizeof(GSIArray_t));
|
_stack = NSZoneMalloc([self zone], sizeof(GSIArray_t));
|
||||||
#endif
|
#endif
|
||||||
GSIArrayInitWithZoneAndCapacity(_stack, [self zone], 64);
|
GSIArrayInitWithZoneAndCapacity(_stack, [self zone], 64);
|
||||||
|
|
||||||
_flags.isRecursive = recurse;
|
_flags.isRecursive = recurse;
|
||||||
_flags.isFollowing = follow;
|
_flags.isFollowing = follow;
|
||||||
_flags.justContents = justContents;
|
_flags.justContents = justContents;
|
||||||
|
|
||||||
_topPath = [[NSString alloc] initWithString: path];
|
_topPath = [[NSString alloc] initWithString: path];
|
||||||
|
|
||||||
localPath = [_mgr fileSystemRepresentationWithPath: path];
|
localPath = [_mgr fileSystemRepresentationWithPath: path];
|
||||||
dir_pointer = _OPENDIR(localPath);
|
dir_pointer = _OPENDIR(localPath);
|
||||||
if (dir_pointer)
|
if (dir_pointer)
|
||||||
{
|
{
|
||||||
GSIArrayItem item;
|
GSIArrayItem item;
|
||||||
|
|
||||||
item.ext.path = @"";
|
item.ext.path = @"";
|
||||||
item.ext.pointer = dir_pointer;
|
item.ext.pointer = dir_pointer;
|
||||||
|
|
||||||
GSIArrayAddItem(_stack, item);
|
GSIArrayAddItem(_stack, item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSLog(@"Failed to recurse into directory '%@' - %@", path,
|
NSLog(@"Failed to recurse into directory '%@' - %@", path,
|
||||||
[NSError _last]);
|
[NSError _last]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue