
4 Dec
2011
4 Dec
'11
1:23 a.m.
On 12/1/11 11:12 AM, dokondr wrote:
Hi, When my program starts it needs to know a complete path to the directory from which it was invoked. In terms of standard shell (sh) I need the Haskell function that will do equivalent to:
#!/bin/sh path=$(dirname $0)
That's not the path to the directory from which the script is invoked (aka, $PWD or, more accurately, the results of `pwd`). That's the path to the directory containing the script. The current working directory (the dir from which the program is invoked, provided the program haven't moved since invocation) can be gotten by System.Directory.getCurrentDirectory in the directory package. Getting the path to the location of the executable is trickier business. -- Live well, ~wren