FROM : Louis Sinclair
DATE : Fri Dec 10 23:47:27 2004
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
DATE : Fri Dec 10 23:47:27 2004
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
| Related mails | Author | Date |
|---|---|---|
| Peter | Dec 10, 13:56 | |
| Louis Sinclair | Dec 10, 23:47 | |
| Douglas Davidson | Dec 11, 03:37 | |
| Ken Ferry | Dec 11, 03:56 | |
| Sherm Pendley | Dec 11, 04:45 |






Cocoa mail archive

