Re: Retrieving application name during runtime
Re: Retrieving application name during runtime
- Subject: Re: Retrieving application name during runtime
- From: Douglas Davidson <email@hidden>
- Date: Fri, 10 Dec 2004 18:37:38 -0800
On Dec 10, 2004, at 2:47 PM, Louis Sinclair wrote:
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];
You can just use [[NSBundle mainBundle] bundlePath] for the full path
to the application bundle, [[NSBundle mainBundle] executablePath] for
the full path to the executable. For an unbundled executable, these
will return the path to the directory in which the executable sits and
the path to the executable.
An application may have several names--the CFBundleName,
CFBundleDisplayName, etc. See the bundle documentation for more
information. These can be obtained programmatically using [[NSBundle
mainBundle] objectForInfoDictionaryKey:].
Command-line arguments can be obtained from [[NSProcessInfo
processInfo] arguments]. NSProcessInfo also can give you some other
related information such as environment variables.
Douglas Davidson
_______________________________________________
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