Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles
Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles
- Subject: Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles
- From: Ken Thomases <email@hidden>
- Date: Mon, 7 Apr 2008 23:50:11 -0500
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.
-Ken
_______________________________________________
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