Proposal: Add getFullProgName

Johan Tibell johan.tibell at gmail.com
Thu Jun 21 21:43:19 CEST 2012


On Thu, Jun 21, 2012 at 12:10 PM, Balazs Komuves <bkomuves at gmail.com> wrote:
> First, as the author of the executable-path library, it seems to me that the
> GHC docs are indeed correct saying that this is impossible to implement on
> some systems. My (conjectural) example for such systems are older BSD
> systems (FreeBSD before v6.0 iirc, NetBSD, OpenBSD). And these are even
> pretty standard Unix systems!

But not supported by GHC HQ:
http://hackage.haskell.org/trac/ghc/wiki/Platforms

This post suggests that we can implement it reliably on all major OS:es:
http://stackoverflow.com/a/1024937/298847

The rest can return argv[0]. It's a big improvement over the current
state of affairs (i.e. getProgName.)

> Another serious issue is that the notion itself does not seems to be
> well-defined. For example think about symlinks (soft, hard?). Probably there
> exist other more strange Unix features I'm not aware of, which are
> complicating the matter further. Symlinks also exist on Windows by the way,
> though not advertised much.

getExecutablePath would return the actual executable (as found by the
OS), bot symlinks. The OS has to resolve symlinks to run the
executable, hence it knows where the executable is.

-- Johan



More information about the Libraries mailing list