create parent directories as needed for addurl --file

This commit is contained in:
Joey Hess 2012-02-16 00:05:17 -04:00
parent 7d1c09fe4a
commit e7aaa55c53

View file

@ -46,8 +46,7 @@ perform :: String -> FilePath -> CommandPerform
perform url file = ifAnnexed file addurl geturl perform url file = ifAnnexed file addurl geturl
where where
geturl = do geturl = do
whenM (liftIO $ doesFileExist file) $ liftIO $ createDirectoryIfMissing True (parentDir file)
error $ "not overwriting existing " ++ file
fast <- Annex.getState Annex.fast fast <- Annex.getState Annex.fast
if fast then nodownload url file else download url file if fast then nodownload url file else download url file
addurl (key, _backend) = do addurl (key, _backend) = do