• 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
telling when a directory is really a bundle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

telling when a directory is really a bundle


  • Subject: telling when a directory is really a bundle
  • From: Martin Redington <email@hidden>
  • Date: Mon, 22 Oct 2007 13:35:48 +0100


According to the docs at

http://developer.apple.com/documentation/CoreFoundation/Conceptual/ CFBundles/Concepts/BundlesAndFinder.html#//apple_ref/doc/uid/20002127- BAJIBGGC

A directory is a package if:

1) it has a known suffix .app, .bundle, etc.
2) it has the bundle bit set
3) it has a known structure indicating its a bundle

I'm trying to construct some AppleScript (from my Cocoa app) to do a Finder Get Info on an item.

tell application "Finder"
set macpath to POSIX file "%@" as text
open information window of %@ macpath
activate
end tell

I seem to need to specify "file" or "folder" in the second slot, and AppleScript errors if I specify folder for a bundle.

So, given a directory, how can I tell if it is a bundle or not. I've tried looking at the bundle bit, but in my /Applications directory, only four .apps seemed to have it turn on.

I could implement 1, 2, and 3 above myself, but that would be hacky.

I could try and initialise a CFBundle or NSBundle with the directory, but that is pretty nasty too.

Is there any easier or cleaner way to programmatically determine whether a directory is a bundle or not?

If I do have to implement it myself, is there any way to get the "known" suffixes?






_______________________________________________

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


  • Follow-Ups:
    • Re: telling when a directory is really a bundle
      • From: Douglas Davidson <email@hidden>
    • Re: telling when a directory is really a bundle
      • From: John Stiles <email@hidden>
    • Re: telling when a directory is really a bundle
      • From: "Dirk Stegemann (Mailing-Lists)" <email@hidden>
    • Re: telling when a directory is really a bundle
      • From: Uli Kusterer <email@hidden>
  • Prev by Date: Re: detecting when an app is beach-balling
  • Next by Date: Re: telling when a directory is really a bundle
  • Previous by thread: Re: Help support with folder symbolic links
  • Next by thread: Re: telling when a directory is really a bundle
  • Index(es):
    • Date
    • Thread