FindBin 0.0.4 → 0.0.5
raw patch · 2 files changed
+10/−3 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- FindBin.cabal +1/−1
- src/System/Environment/FindBin.hs +9/−2
FindBin.cabal view
@@ -1,5 +1,5 @@ name: FindBin-version: 0.0.4+version: 0.0.5 copyright: 2008-2011 Audrey Tang homepage: https://github.com/audreyt/findbin license: BSD3
src/System/Environment/FindBin.hs view
@@ -23,14 +23,21 @@ getProgPath = alloca $ \p_argc -> alloca $ \p_argv -> do getProgArgv p_argc p_argv argv <- peek p_argv- findBin =<< peekCString =<< peekElemOff argv 0+ arg0 <- peekCString =<< peekElemOff argv 0+ case arg0 of+ "<interactive>" -> alloca $ \p_argc' -> alloca $ \p_argv' -> do+ getFullProgArgv p_argc' p_argv'+ argc' <- peek p_argc'+ argv' <- peek p_argv'+ findBin =<< peekCString =<< peekElemOff argv' (pred $ fromEnum argc')+ _ -> do+ findBin arg0 where directoryOf "" = directoryOf "." directoryOf x = do x' <- canonicalizePath x let path = takeDirectory x' return (length path `seq` path)- findBin "<interactive>" = findBin "" findBin s = case takeDirectory s of "" -> do -- This should work for ghci as well, as long as nobody name