• 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: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles


  • Subject: Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles
  • From: Douglas Davidson <email@hidden>
  • Date: Wed, 9 Apr 2008 08:32:33 -0700


On Apr 8, 2008, at 6:37 PM, Mike wrote:

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.

I should point out that checking whether [NSBundle bundleWithPath:] returns non-nil is probably not what you want. You can create an NSBundle from any readable directory, and it will operate using whatever bundle structures are present within that directory. More likely what you are interested in is whether a particular directory is a file package, i.e., whether it is intended to be presented to the user as a single opaque object; this information can be obtained from NSWorkspace or Launch Services, which can also provide additional information such as whether a particular directory represents an application. Looking for an extension such as .app is not necessarily reliable for this purpose.


Douglas Davidson

_______________________________________________

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: 
 >fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles (From: Mike <email@hidden>)
 >Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles (From: Ken Thomases <email@hidden>)
 >Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles (From: Mike <email@hidden>)
 >Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles (From: Ken Thomases <email@hidden>)
 >Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles (From: Mike <email@hidden>)

  • Prev by Date: Re: Text with translucent Background
  • Next by Date: some questions about creating image thumbnails
  • Previous by thread: Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles
  • Next by thread: Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles
  • Index(es):
    • Date
    • Thread