4 ms·
That doesn't work. It only gives you the leaf (basename), not the path.
by talex5 13y ago
That doesn't work. It only gives you the leaf (basename), not the path.
- nousernamesleft 13y agogetExecutablePath
- talex5 13y agoThanks - good to know that's been fixed now. I don't know why all the previous requests were marked as "wontfix".
- nousernamesleft 13y agoHuh? Are you sure they weren't marked as duplicates of the original request made in 2010, which was closed as "fixed" in 2012? The functionality was available as a library on hackage starting in 2009. It was added to the standard library in 2012 as part of ghc 7.6.1. Your website says you were testing with 7.6.3. https://www.haskell.org/ghc/docs/latest/html/users_guide/release-7-6-1.html https://www.haskell.org/ghc/docs/latest/html/users_guide/rel...
- talex5 13y agoI don't remember exactly how I searched for it, but the top hit on Google for "haskell argv[0]" today is https://ghc.haskell.org/trac/ghc/ticket/3199 https://ghc.haskell.org/trac/ghc/ticket/3199, which is marked "wontfix" and includes a workaround (which I used). The second link is to Environment.hs, which would have solved my problem, if I'd known what I was looking for. I think I'd have just clicked Back when I saw it was library source code, though. The third link is http://hackage.haskell.org/package/system-argv0-0.1 http://hackage.haskell.org/package/system-argv0-0.1 - which says "Use this instead of System.Environment.getProgName if you want the full path, and not just the last component." (note: technically, my code was still the correct solution, since 0install targets Ubuntu 12.04, but yes ideally I would have found that newer versions did support it more simply)