Re: Finding other apps' paths - deterministically!
Re: Finding other apps' paths - deterministically!
- Subject: Re: Finding other apps' paths - deterministically!
- From: Ken Thomases <email@hidden>
- Date: Thu, 18 Sep 2008 14:44:31 -0500
On Sep 18, 2008, at 1:47 PM, Jerry Krinock wrote:
The methods for finding applications,
-[NSWorkspace fullPathForApplication:]
-[NSWorkspace absolutePathForAppBundleWithIdentifier:]
AppleScript's 'path to application'
all return only ONE result. If there is more than installation of
the application, which often happens out here in real life, the
above methods will often pick different installations, and even if
you run the same methods several minutes apart I sometimes get
different answers.
Is there any way to make these methods behave deterministically? If
not, what's a better way? Do I have to do a Spotlight search? I
know that unix 'find' would be way too slow.
The above methods all depend on Launch Services. I've seen the same
non-deterministic behavior that you have.
One solution, which is a complete hack, involves tagging the
application with a claim to handle a certain custom URL scheme. Then
you can use LSCopyApplicationURLsForURL with a fake URL of that
scheme. That's the only Launch Services API that I'm aware of that
actually returns a list of applications (rather than, for example, a
list of application bundle IDs which doesn't address your problem).
This, of course, only works if the application is one you're
developing rather than a third-party app.
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