Hello all,
I'm using a directory enumerator to recurse through a series of directories,
and it always fails after going through a certain number of enumerations. If I
enumerate through the same directory over and over, it tends to fail in about
the same place, but if I enumerate through other directories, it will fail but
after completing a different number of enumerations, so I don't think it's
necessarily a memory thing or something wrong with my file system.
It always comes back with the same error number (256), which macerror cannot
identify:
"2010-01-13 10:14:34.078 afindex[821:1b03] directoryEnumerator failed on enum
1598, error description: The operation couldn\U2019t be completed.
(NSCocoaErrorDomain error 256.)"
Here's my code, I can't figure out why it's failing...
/* enumeration.m */
__block NSUInteger i = 0;
NSFileManager *fm = [[NSFileManager alloc] init];
NSDirectoryEnumerator *dirEnum = [fm enumeratorAtURL:folderURL
includingPropertiesForKeys:nil
options:NSDirectoryEnumerationSkipsHiddenFiles ^
NSDirectoryEnumerationSkipsPackageDescendants
errorHandler:^(NSURL *url, NSError *error){
NSLog(@"directoryEnumerator failed on enum %i,
error description: %@",i,[error localizedDescription]);
return NO;
}];
NSAutoreleasePool *ap = [[NSAutoreleasePool alloc] init];
NSURL *aPath;
while (aPath = [dirEnum nextObject]) {
if ( 1 ) {
NSDictionary *metadataDict = [engine metadataDictionaryForFile:[aPath path] ];
[database indexMetadata:metadataDict forFileAtURL:aPath];
}
if (++i % 50 == 0 ) {
[ap release];
ap = [[NSAutoreleasePool alloc] init];
}
}
[path release];
[ap release];
[fm release];_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]