Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

telling when a directory is really a bundle




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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.