Skip navigation.
 
mlRe: Retrieving application name during runtime
FROM : Sherm Pendley
DATE : Sat Dec 11 04:45:02 2004

On Dec 10, 2004, at 7:56 AM, Peter wrote:

> 1) Is there a method to retrieve application name of the running
> program itself ?


NSProcessInfo *pi = [NSProcessInfo processInfo];

NSString *appName = [pi processName];

> 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)


id exePath = [[pi arguments] objectAtIndex: 0];

> 3) Is it possible to retrieve command line arguments via Cocoa ?


NSArray *args = [pi arguments];

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

Related mailsAuthorDate
mlRetrieving application name during runtime Peter Dec 10, 13:56
mlRe: Retrieving application name during runtime Louis Sinclair Dec 10, 23:47
mlRe: Retrieving application name during runtime Douglas Davidson Dec 11, 03:37
mlRe: Retrieving application name during runtime Ken Ferry Dec 11, 03:56
mlRe: Retrieving application name during runtime Sherm Pendley Dec 11, 04:45