• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDirectoryEnumerator and URLs (PS)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >NSDirectoryEnumerator and URLs (From: Jamie Hardt <email@hidden>)

  • Prev by Date: Re: Displaying a non-contentual menu & attachPopUpWithFrame
  • Next by Date: Re: Best practice example for a setup wizard?
  • Previous by thread: Re: NSDirectoryEnumerator and URLs
  • Next by thread: Re: NSDirectoryEnumerator and URLs (PS) [resolved]
  • Index(es):
    • Date
    • Thread