Re: Correct way to tell if a path is to a .bundle?
Re: Correct way to tell if a path is to a .bundle?
- Subject: Re: Correct way to tell if a path is to a .bundle?
- From: Rick Mann <email@hidden>
- Date: Fri, 25 Sep 2009 17:41:11 -0700
On Sep 25, 2009, at 17:15:45, Peter Ammon wrote:
On Sep 24, 2009, at 8:09 PM, Jens Alfke wrote:
On Sep 24, 2009, at 6:41 PM, Rick Mann wrote:
I'm scanning a directory for plugins for my app. Given a path,
what's the right way to tell if it's a path to a bundle?
-[NSWorkspace isFilePackageAtPath:].
Actually, bundles are often packages, and vice versa, but you can be
either without the other.
A file package is a directory that is presented as a single file to
the user, while a bundle is a directory with a particular layout.
For example, frameworks are bundles, but not packages. If you
navigate to a .framework file in Finder, you will see that it looks
like a folder. Likewise, you can take any directory and set the
package bit, and it becomes a package.
The usual way is to just try loading the URL as a bundle, and see if
you succeed. You could also define a particular extension for your
plugin type, and look for files of that extension, with the
assistance of CFBundleCreateBundlesFromDirectory.
Unfortunately, I don't think CFBundleCreateBundlesFromDirectory() will
work for me. It creates CFBundleRefs, not NSBundles, and it loads
them, which I want to avoid if possible.
I think I just have to check the filenames' extensions as I iterate
them.
_______________________________________________
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