[Haskell-cafe] How to get a file path to the program invoked?
Felipe Almeida Lessa
felipe.lessa at gmail.com
Thu Dec 1 18:53:37 CET 2011
On Thu, Dec 1, 2011 at 3:41 PM, Simon Hengel <simon.hengel at wiktory.org> wrote:
>> > How to get this path in Haskell?
>>
>> If I understand you correctly, you want
>>
>> takeDirectory `fmap` getProgName
>
> I think getProgName does not give you the full path, but only the
> program name.
Neither does $0, does it? It depends on how the program is called.
You can always use System.Directory.getCurrentDirectory with
System.FilePath.{isRelative,replaceDirectory} if you somehow need the
full path. Note, however, that not even this is generally guaranteed
to be correct.
Cheers,
--
Felipe.
More information about the Haskell-Cafe
mailing list