• 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: POSIX equiv to [nsBundle mainBundle] bundlePath]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: POSIX equiv to [nsBundle mainBundle] bundlePath]


  • Subject: Re: POSIX equiv to [nsBundle mainBundle] bundlePath]
  • From: "tobias ford..." <email@hidden>
  • Date: Fri, 25 Jul 2003 16:51:55 -0500

Thanks. I hadn't seen that example. It's really close to what I'm desiring.


Jaguar and above define _NSGetExecutablePath in the System framework.

It's a snap if you will be linking Foundation already, but if you don't go that route
their is a straight C solution in sample code on Apple's site.

The solution they present is not portable to other unix flavors, but is the most efficient
way for OSX.

I am unaware of a portable approach which does not insist you be called first,
This one relies on exec stashing a copy of the executables path immediately
after the trailing NULL of envp.

http://developer.apple.com/samplecode/Sample_Code/Security/AuthSample/ getpath.c.htm

I don't recall if it this path contains symlinks, if it does, a call to realpath(3) will
normalize for you.


-------------------
Tobias Ford...
email@hidden email@hidden
-------------------
Senior Software Engineer @ WolfPack Studios
www.wolfpackstudios.com www.shadowbane.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: POSIX equiv to [nsBundle mainBundle] bundlePath] (From: James Quick <email@hidden>)

  • Prev by Date: simple tableview question
  • Next by Date: Re: plist Problem
  • Previous by thread: Re: POSIX equiv to [nsBundle mainBundle] bundlePath]
  • Next by thread: Using views to draw within custom NSCell subclasses
  • Index(es):
    • Date
    • Thread