
13 Jun
2012
13 Jun
'12
12:49 a.m.
On Tue, Jun 12, 2012 at 8:08 PM, Bardur Arantsson
Not saying it's not an improvement over getProgName (definitely is), but if the intent is to provide the most accurate name of the executable which is running, then...
You should probably read the /proc/self/exe symlink on Linux. (Of course /proc may not be mounted so you'll need a fallback in any case...)
I believe FreeBSD and Solaris have similar methods using /proc.
On Win32 it seems that using GetModuleFileName with a NULL first parameter is the way to go:
http://msdn.microsoft.com/en-us/library/ms683197%28VS.85%29.aspx
Good ideas. If we do that, do we also want a way to access the raw argv[0]?