• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Retrieving application name during runtime
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Retrieving application name during runtime
      • From: Douglas Davidson <email@hidden>
References: 
 >Retrieving application name during runtime (From: Peter <email@hidden>)

  • Prev by Date: Re: Help please... NSTextField not updating via Cocoa Bindings
  • Next by Date: Re: Kill other process's warning dialog
  • Previous by thread: Retrieving application name during runtime
  • Next by thread: Re: Retrieving application name during runtime
  • Index(es):
    • Date
    • Thread