Re: Retrieving application name during runtime
Re: Retrieving application name during runtime
- Subject: Re: Retrieving application name during runtime
- From: Louis Sinclair <email@hidden>
- Date: Fri, 10 Dec 2004 17:47:27 -0500
You can get the path to the running executable with the following:
NSBundle* bundle = [NSBundle mainBundle];
NSString* path = [[NSString alloc] initWithString:[bundle executablePath]];
<do something with the string>
[path release];
Look for more info in the docs for NSBundle.
--
Louis Sinclair
At 07:56 AM 12/10/2004, Peter wrote:
I have been trying to get the executable name of the running Cocoa
program. I understand the application name is stored in the Info.plist ->
CFBundleExecutable but it seems there is no Cocoa method that retrieve
the application name. The reason of retrieving application name rather
fixing it (#DEFINE or string table) is because I have a few different
program names of the same program, also different options for different name.
My questions are,
1) Is there a method to retrieve application name of the running program
itself ?
2) Is it possible to get the path of the executable via Cocoa ?
( I know of one possiblity by getting via main(argc, argv) --> argv[0]
by C)
3) Is it possible to retrieve command line arguments via Cocoa ?
Thanks in Advance.
Peter
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden