• 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: Finding process path from Cocoa?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding process path from Cocoa?


  • Subject: Re: Finding process path from Cocoa?
  • From: "email@hidden" <email@hidden>
  • Date: Wed, 9 Dec 2009 10:18:28 +0000

On 9 Dec 2009, at 09:53, Alastair Houghton wrote:

>>
>> Yes. ([[[NSProcessInfo processInfo] arguments] objectAtIndex:0])
>
> No, no, no and thrice no.
>
> What that gives you is the content of argv[0], which *is not* (necessarily) the path to your program.  If you think it is, then to disabuse you of the notion I can write a program like this:
> #include <unistd.h>
>
>  int
>  main (void) {
>    execl ("/Applications/YourApp.app/Contents/MacOS/YourApp",
> 	   "This is not my path",
> 	   NULL);
>  }

The docs for execl(3) do state the convention:

The first argument, by convention, should point to the file name associated with the file being executed.

This being a Cocoa list we should expect that all conventions are being followed to the letter, by everyone, everywhere (though in this case I wouldn't bet the farm on it)._______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Finding process path from Cocoa?
      • From: Alastair Houghton <email@hidden>
References: 
 >Finding process path from Cocoa? (From: Laurent Daudelin <email@hidden>)
 >Re: Finding process path from Cocoa? (From: Nick Zitzmann <email@hidden>)
 >Re: Finding process path from Cocoa? (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Re: Finding process path from Cocoa?
  • Next by Date: Re: Unable to write in InfoPlist.strings file from cpp
  • Previous by thread: Re: Finding process path from Cocoa?
  • Next by thread: Re: Finding process path from Cocoa?
  • Index(es):
    • Date
    • Thread