diff options
author | Joey Hess <joey@kitenet.net> | 2011-08-27 12:31:50 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-08-27 12:31:50 -0400 |
commit | 6e750764b7d30d9cb0684cdaadd79ec091a4fda6 (patch) | |
tree | adcc1c2dac4c1b5ad7a941546250e0931a45c5fc /Utility.hs | |
parent | f82da1d9dca0712cdd87e3fc0ed8a2c2e2440228 (diff) |
The wget command will now be used in preference to curl, if available.
Got tired of curl's various ugly progress bars.
Diffstat (limited to 'Utility.hs')
-rw-r--r-- | Utility.hs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Utility.hs b/Utility.hs index 788dc4103..451b1b44f 100644 --- a/Utility.hs +++ b/Utility.hs @@ -15,7 +15,8 @@ module Utility ( dirContains, dirContents, myHomeDir, - catchBool + catchBool, + inPath ) where import IO (bracket) @@ -94,3 +95,12 @@ myHomeDir = do {- Catches IO errors and returns a Bool -} catchBool :: IO Bool -> IO Bool catchBool = flip catch (const $ return False) + +{- Checks if a command is available in PATH. -} +inPath :: String -> IO Bool +inPath command = search =<< getSearchPath + where + search [] = return False + search (d:ds) = do + e <- doesFileExist $ d </> command + if e then return True else search ds |