diff options
Diffstat (limited to 'Remote/Directory.hs')
-rw-r--r-- | Remote/Directory.hs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/Remote/Directory.hs b/Remote/Directory.hs index 6d3a5da7d..b592f41ff 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -8,7 +8,6 @@ module Remote.Directory (remote) where import qualified Data.ByteString.Lazy.Char8 as L -import System.IO.Error import qualified Data.Map as M import Common.Annex @@ -72,13 +71,13 @@ store :: FilePath -> Key -> Annex Bool store d k = do src <- fromRepo $ gitAnnexLocation k let dest = dirKey d k - liftIO $ catchBool $ storeHelper dest $ copyFileExternal src dest + liftIO $ catchBoolIO $ storeHelper dest $ copyFileExternal src dest storeEncrypted :: FilePath -> (Cipher, Key) -> Key -> Annex Bool storeEncrypted d (cipher, enck) k = do src <- fromRepo $ gitAnnexLocation k let dest = dirKey d enck - liftIO $ catchBool $ storeHelper dest $ encrypt src dest + liftIO $ catchBoolIO $ storeHelper dest $ encrypt src dest where encrypt src dest = do withEncryptedContent cipher (L.readFile src) $ L.writeFile dest @@ -100,12 +99,12 @@ retrieve d k f = liftIO $ copyFileExternal (dirKey d k) f retrieveEncrypted :: FilePath -> (Cipher, Key) -> FilePath -> Annex Bool retrieveEncrypted d (cipher, enck) f = - liftIO $ catchBool $ do + liftIO $ catchBoolIO $ do withDecryptedContent cipher (L.readFile (dirKey d enck)) $ L.writeFile f return True remove :: FilePath -> Key -> Annex Bool -remove d k = liftIO $ catchBool $ do +remove d k = liftIO $ catchBoolIO $ do allowWrite dir removeFile file removeDirectory dir @@ -115,8 +114,4 @@ remove d k = liftIO $ catchBool $ do dir = parentDir file checkPresent :: FilePath -> Key -> Annex (Either String Bool) -checkPresent d k = dispatch <$> check - where - check = liftIO $ try $ doesFileExist (dirKey d k) - dispatch (Left e) = Left $ show e - dispatch (Right v) = Right v +checkPresent d k = liftIO $ catchMsgIO $ doesFileExist (dirKey d k) |