This is how I finally solved this problem for POSIX complaint system:<br><br>--<br>-- TestRun<br>--<br>module Main where<br>import System.Cmd (rawSystem)<br>import System.Directory (getCurrentDirectory)<br>import System.Environment.Executable (ScriptPath(..), getScriptPath)<br>
import System.FilePath.Posix (splitFileName)<br> <br> main = do <br> <br> path <- getMyPath<br> putStrLn $ "myPath = " ++ path<br> let cmdLine = path ++ "args.sh"<br> rawSystem cmdLine ["iphone", "test-twitts.txt"]<br>
<br>{--<br>data ScriptPath Source<br><br>Constructors:<br>Executable FilePath it was (probably) a proper compiled executable<br>RunGHC FilePath it was a script run by runghc/runhaskell<br>Interactive we are in GHCi <br>
--}<br><br>getMyPath = do<br> curDir <- getCurrentDirectory -- from System.Directory<br> scriptPath <- getScriptPath -- from System.Environment.Executable<br> let path = getMyPath' scriptPath curDir<br> return path<br>
<br>getMyPath' (Executable path) _ = fst (splitFileName path)<br>getMyPath' (RunGHC path) _ = fst (splitFileName path) <br>getMyPath' Interactive curDir = curDir++"/"<br><br><br>-- <br>All the best,<br>
Dmitri O. Kondratiev<br><br>"This is what keeps me going: discovery"<br><a href="mailto:dokondr@gmail.com" target="_blank">dokondr@gmail.com</a><br><a href="http://sites.google.com/site/dokondr/welcome" target="_blank">http://sites.google.com/site/dokondr/welcome</a><br>
<br><br>