Ken Thomases wrote:
On Apr 7, 2008, at 10:49 PM, Mike wrote:
In that case, how do I get the fullpath to the item from the iterator? There doesn't seem to be any key in the info dictionary for the current item's fullpath.

Huh? You mean the enumeratedItem from your original code snippet? You never indicated where you got that from. I assumed it was already a full path. That's how your code snippet used it.

If you're instead getting a relative path from an NSDirectoryEnumerator, you should combine that relative path with the original directory path that you passed to -[NSFileManager enumeratorAtPath:]. The documentation for that method shows you how to do that with stringByAppendingPathComponent:.

If you really are using NSDirectoryEnumerator to scan a large hierarchy for applications, be sure to use an inner auto-release pool to clean up intermediate objects as you go. Also, once you detect that a path corresponds to a bundle (+[NSBundle bundleWithPath:] returns non-nil), use -[NSDirectoryEnumerator skipDescendents] to avoid enumerating the contents of the bundle -- unless you're really interested in applications buried inside of other applications, it will just be wasted time.

Yeah, I found that out the hard way. I just check for bundle or .app and when I hit one, I immediately check its creator code. If it's not the one I want, I skip descendents and it works fine. Before that it would iterate everything and when it hit a huge app like Garageband it would take forever. And I am enumerating from the vol. root.

You were right - I tried using the item returned from the iterator for the fullpath and it works fine. Thanks for the help!

Mike
_______________________________________________

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