Re: full path to the currently running executable
Re: full path to the currently running executable
- Subject: Re: full path to the currently running executable
- From: Jean-Daniel Dupas <email@hidden>
- Date: Sun, 18 Jan 2009 17:48:53 +0100
_NSGetExecutablePath() (from <mach-o/dyld.h>)
man 3 dyld :
_NSGetExecutablePath() copies the path of the main executable into the
buffer buf. The bufsize parameter should initially be the size of the
buffer. This
function returns 0 if the path was successfully copied. It
returns -1 if the buffer is not large enough, and * bufsize is set to
the size required. Note
that _NSGetExecutablePath() will return "a path" to the
executable not a "real path" to the executable. That is, the path may
be a symbolic link and not the
real file. With deep directories the total bufsize needed could
be more than MAXPATHLEN.
After that, you may want to use realpath() to get the real path.
Le 18 janv. 09 à 17:39, Joel Reymont a écrit :
It's possible to get the full path to the currently running
executable on Linux by looking at /proc/self/exe or /proc/curproc/
file.
How can I do this on Mac OSX?
Thanks, Joel
---
http://twitter.com/wagerlabs
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden