Balazs, thanks for your comments!<br>The first comment works just fine.<br>With &lt;/&gt; operator I get this:<br><br>Main System.Environment.Executable System.FilePath&gt; &quot;/abc&quot; &lt;/&gt; &quot;/&quot;<br>&quot;/&quot;<br>
<br>Instead of getting &quot;/abc/&quot; I get &quot;/&quot;. What am I doing wrong?<br><br><div class="gmail_quote">On Mon, Dec 5, 2011 at 6:03 PM, Balazs Komuves <span dir="ltr">&lt;<a href="mailto:bkomuves@gmail.com">bkomuves@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>Two small comments:<br><br>1) This should work on Windows too, if you just leave out the word &quot;Posix&quot; from the source:<br>
import System.FilePath (splitFileName)<br><br>2) In general when dealing with paths, use the &lt;/&gt; operator (from System.FilePath)<br>
instead of ++ &quot;/&quot; ++<br><font color="#888888"><br>Balazs</font><div><div></div><div class="h5"><br><br><div class="gmail_quote">On Mon, Dec 5, 2011 at 1:44 PM, dokondr <span dir="ltr">&lt;<a href="mailto:dokondr@gmail.com" target="_blank">dokondr@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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 &lt;- getMyPath<br>  putStrLn $ &quot;myPath = &quot; ++ path<br>  let cmdLine = path ++ &quot;args.sh&quot;<br>  rawSystem cmdLine  [&quot;iphone&quot;, &quot;test-twitts.txt&quot;]<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 &lt;- getCurrentDirectory -- from System.Directory<br>  scriptPath  &lt;- getScriptPath -- from System.Environment.Executable<br>  let path = getMyPath&#39; scriptPath curDir<br>  return path<br>


  <br>getMyPath&#39; (Executable path) _ = fst (splitFileName path)<br>getMyPath&#39; (RunGHC path) _  = fst (splitFileName path) <br>getMyPath&#39; Interactive curDir = curDir++&quot;/&quot;<br><font color="#888888"><br>

</font><br>
</blockquote></div></div></div></blockquote></div>