How to detect current executable file name?

Marco Leise Marco.Leise at gmx.de
Mon Feb 18 16:26:01 PST 2013


Am Mon, 18 Feb 2013 10:07:45 +0100
schrieb Jacob Carlborg <doob at me.com>:

> Yeah, GetModuleFileNameW should be used. I'm pretty sure the other 
> platforms will return UTF-8.

I also found that console output on Windows works best with
wchars.
Linux doesn't have any official support to get the module file
name, except for "readlink /proc/<pid>/exe". Maybe because you
are not supposed to use e.g. /usr/local/… or ~/.<program>/
for data or because file paths don't mean that much when its
technically possible to move, hardlink or delete names of a
running program (unlike on Windows).
Despite that I find such a function useful in Phobos.

-- 
Marco



More information about the Digitalmars-d-learn mailing list