Re: How to get all the path of an application present on the disk
Re: How to get all the path of an application present on the disk
- Subject: Re: How to get all the path of an application present on the disk
- From: Ken Thomases <email@hidden>
- Date: Thu, 21 Mar 2013 10:39:29 -0500
On Mar 21, 2013, at 9:39 AM, Jerry Krinock wrote:
> To the original question, I don't think there's an easy way to do this. I don't think Launch Services remembers any more than the most recently-recognized version.
There's one Launch Services function which returns paths for all copies of all applications which meet a certain criterion: LSCopyApplicationURLsForURL(). You can "mark" your applications by having them claim some bizarre fake URL scheme, such as "com-yourcompany-yourapp-bogus-url-scheme". Then, you can use LSCopyApplicationURLsForURL() to search for all applications which can handle the URL "com-yourcompany-yourapp-bogus-url-scheme:junk".
Yes, this is a gross hack. Yes, it can only be used in situations where you've planned for it in advance – you have to have marked your apps. If you're adding a feature to a new version of your app that relies on this, then the old versions won't have been marked.
But it's the only public API that can do this. Launch Services definitely remembers more than the most recently recognized version, as you can see by running:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -dump
Cheers,
Ken
_______________________________________________
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