Re: getting the path to the executing program
Sadly, this doesn't seem to work: 9:26am albini:SVMseq/ cat Foo.hs module Main where import System.Environment main = getEnv "_" >>= putStrLn 9:27am albini:SVMseq/ ghc Foo.hs -o foo 9:27am albini:SVMseq/ ./foo Fail: does not exist Action: getEnv Reason: no environment variable File: _ On Thu, 8 Jan 2004, Christopher Milton wrote:
The environmental var "_" in $ENV{"_"} (pardon my Perlish) holds the full path name of the command currently executing (itself), at least on RedHat Linux and HP-UX, so you should be able to use getEnv... I think...
--- Hal Daume III <hdaume@ISI.EDU> wrote:
is there a function, related to getProgName, which returns the (absolute) path to the current program?
basically, i want to be able to read a file which i know will be in the same directory as the current program, but not necessarily in the same directory that we're running it from.
===== Christopher Milton cmiltonperl@yahoo.com
-- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume
participants (1)
-
Hal Daume III