Binary relocatability API for glib
Submitted by Mike Hearn
It'd be nice to have a GetModuleFileName style API in glib that abstracts the different ways a program can locate its own absolute path at runtime.
On Windows you can use GetModuleFileName to locate the absolute path of the current process. On Linux reading /proc/self/exe does the same thing. I do not know what the equivalent is on other UNIX systems.
One thing I'm not sure about is whether to support libraries or not. Windows and Linux let you determine the absolute path of a library by passing in a pointer to somewhere inside the image, for instance the address of an empty string. Again I am not sure how portable that is outside these two platforms.
I hope to write a patch for this in the next few months.