This commit is contained in:
Joey Hess 2010-10-14 20:05:04 -04:00
parent b8ba60428a
commit 4c3ad80f32
6 changed files with 26 additions and 22 deletions

View file

@ -3,7 +3,8 @@
module Backend.Url (backend) where
import Control.Monad.State
import Control.Monad.State (liftIO)
import Data.String.Utils
import System.Cmd
import System.Exit
import BackendTypes
@ -30,9 +31,11 @@ dummyOk :: Key -> Annex Bool
dummyOk url = return True
downloadUrl :: Key -> FilePath -> Annex Bool
downloadUrl url file = do
liftIO $ putStrLn $ "download: " ++ (show url)
result <- liftIO $ rawSystem "curl" ["-#", "-o", file, (show url)]
downloadUrl key file = do
liftIO $ putStrLn $ "download: " ++ url
result <- liftIO $ rawSystem "curl" ["-#", "-o", file, url]
if (result == ExitSuccess)
then return True
else return False
where
url = join ":" $ drop 1 $ split ":" $ show key