telling when a directory is really a bundle
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