Re: NSDirectoryEnumerator and URLs (PS)
Re: NSDirectoryEnumerator and URLs (PS)
- Subject: Re: NSDirectoryEnumerator and URLs (PS)
- From: Jamie Hardt <email@hidden>
- Date: Wed, 13 Jan 2010 12:00:47 -0800
On Jan 13, 2010, at 11:38 AM, Robert Martin wrote:
> PS - Also, when I use NSDirectoryEnumerator, it returns a string, not an URL...
The documentation actually doesn't say... I assumed that a directory enumerator that is created with a URL would return URLs, but I guess not... In any case, mutatis mutandis, this code still fails in about the same way:
/* enumeration2.h */
-(void)indexFolder:(NSString *)folderPath {
NSString *localFolderPath = [folderPath copy];
NSFileManager *fm = [[NSFileManager alloc] init];
NSDirectoryEnumerator *dirEnum = [fm enumeratorAtPath:localFolderPath];
NSAutoreleasePool *ap = [[NSAutoreleasePool alloc] init];
NSString *aPath;
while (aPath = [dirEnum nextObject]) {
NSString *fullPath = [localFolderPath stringByAppendingPathComponent:aPath];
BOOL isDir = NO;
if ( [fm fileExistsAtPath:fullPath isDirectory:&isDir] && !isDir ) {
NSDictionary *metadataDict = [engine metadataDictionaryForFile:fullPath ];
[database indexMetadata:metadataDict forFileAtPath:fullPath];
}
if (++i % 50 == 0 ) {
[ap release];
ap = [[NSAutoreleasePool alloc] init];
}
}
[localFolderPath release];
[ap release];
[fm release];
}_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden