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 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]

Reply via email to