Re: Bundle identifiers
Re: Bundle identifiers
- Subject: Re: Bundle identifiers
- From: Douglas Davidson <email@hidden>
- Date: Thu, 16 May 2002 17:37:27 -0700
On Saturday, May 11, 2002, at 12:51 AM, Yves Peneveyre wrote:
I would like to launch an application with its bundle identifier.
Or, at least, I would like to know where is the application
corresponding to
a bundle identifier.
I tried to use the Core Foundation but it does not work.
For example, I tried the following code :
CFBundleRef myBundle;
CFURLRef myRef;
myBundle =
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.calculator"));
myRef = CFBundleCopyBundleURL(myBundle);
In this code, CFBundleGetBundleWithIdentifier return a null value.
Why ?
And, finally, does it exist a way to do that with Cocoa ?
CFBundle doesn't scan the disk, period.
CFBundleGetBundleWithIdentifier() returns bundles that are loaded into
your process, or otherwise have already been instantiated. The primary
intended purpose is to allow bundles to locate themselves after they
have been loaded. What you are looking for is Launch Services. Launch
Services knows what is on the disk.
The usual Cocoa equivalent for Launch Services is NSWorkspace. However,
NSWorkspace does not currently expose a method to look up applications
by identifier. It may do so at some point in the future, but for now
you will probably have to go to Launch Services directly.
Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.