Re: launching 2 same applications
Re: launching 2 same applications
- Subject: Re: launching 2 same applications
- From: "M. Uli Kusterer" <email@hidden>
- Date: Tue, 7 Oct 2003 20:38:06 +0200
At 17:56 Uhr +0000 07.10.2003, Sean Liong wrote:
The main problem is that how can I launch the application only after
determine that it is reside in the path I want.
For example if the application was on a CD, the user can launch the
application which is on the CD, but actually the application on the
CD will check it own path, the path was not the desired path so the
application quit itself and run the application from the desired
path. Can this be achieved without any other app involved? There
shall only be one application.
To get your app's own path, you can use NSBundle methods to get at
the path of the mainBundle.
To find another application, check out the LaunchServices APIs or
NSWorkspace or NSFileManager. One of these should contain a method to
look up an application using its bundle identifier. Though I'm not
sure whether that wouldn't get the current application as well...
But why do you have something like a *desired* path at all? Why is it
so bad that the user could launch your application from the CD? If
they want to put your application in ~/Applications or in ~/Work
Related/Sean's App/ why don't you let them? What deeper reason do you
have? What are you trying to achieve?
-> If this is some sort of copy protection, just let it go. Annoying
your legitimate users with arbitrary restrictions just to catch the
small percentage that cheats doesn't pay off, it only causes damage
by scaring away legitimate users.
-> If you're trying to find another item that is close to your app,
try simply embedding it in your application's bundle instead.
-> If you're working with another piece of software (e.g. a
command-line tool to which you don't have the source code that
expects files in certain places), then add code to your application
that checks for the existence of these files and the tool at launch
time and installs them from canned copies in your bundle.
It sounds a lot like you're trying to solve a problem the wrong way.
What exactly is your actual (higher-level) problem? If you tell us,
we could maybe point you at much better solutions if you let us.
My apologies in advance if you should have a legitimate reason for
this. In that case, maybe I'm saving a beginner from making the
mistake I think is being made here.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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.