Re: Bundle identifiers - solution!
Re: Bundle identifiers - solution!
- Subject: Re: Bundle identifiers - solution!
- From: Charles Srstka <email@hidden>
- Date: Sat, 11 May 2002 15:21:10 -0500
Never mind my previous post! Your question got me curious, so I took
another look. Turns out there is an API that I missed last time I
scanned the LaunchServices docs, and it does just what you want. Here's
some sample code I wrote, that works:
char *wildcard = "****";
NSURL *url;
LSFindApplicationForInfo((OSType)(*wildcard),(CFStringRef)@"com.apple.mail"
,NULL,NULL,(CFURLRef *)(&url));
NSLog([url path]);
Running this gets the path to Mail.app. You need to add
ApplicationServices.framework to your project. You don't need to include
any headers - they're apparently automatically imported by Cocoa.
This is really cool, since I've got two app ideas that I've been
considering for a while that could use this, if only I knew how. Now I
do, thanks to your question. :-)
On Saturday, May 11, 2002, at 02:57 PM, Charles Srstka wrote:
>
I've wondered about this for some time too.
>
>
CFBundleGetBundleWithIdentifier only works on bundles that are
>
currently loaded. Just to get the application associated with some
>
bundle, I'm guessing you'd have to get it out of the LS files.
>
Unfortunately, the format seems to be closed, and I cannot find any API
>
to do what we want...
>
>
On Saturday, May 11, 2002, at 02:51 AM, Yves Peneveyre wrote:
>
>
> Hello all !
>
>
>
> 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 ?
>
>
>
>
>
> Thank you very much for your help.
>
>
>
> Best Regards
>
>
>
> Yves Peneveyre
>
>
>
> ----------------------------------------------------------------
>
> Yves Peneveyre direct line : ++41 21 802 5754
>
> Software Engineer fax : ++41 21 802 5751
>
> LooKware development Ltd phone : ++41 21 802 5750
>
> 6B, ch du Trisi email: email@hidden
>
> CH - 1028 Priverenges web: http://www.lookware.ch
>
> ----------------------------------------------------------------
>
> _______________________________________________
>
> 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.
>
_______________________________________________
>
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.
_______________________________________________
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.