diff options
author | Joey Hess <joey@kitenet.net> | 2012-03-04 03:25:41 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-03-04 03:25:41 -0400 |
commit | 46383140015fb607ba7d9c7bf5a3c2c435dfb548 (patch) | |
tree | 6b835129a975956fb7b483f7083225a03be613cd /Remote | |
parent | 9856c24a5996f2d493c559cd9ea6b27b8127694a (diff) |
add progress display when receiving files
That was actually really easy. But, when getting a file from an encrypted
directory special remote, no meter can be shown, because the total file
size is not known.
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Directory.hs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Remote/Directory.hs b/Remote/Directory.hs index ab2a064ec..40e6dc72d 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -13,7 +13,6 @@ import qualified Data.Map as M import Control.Exception (bracket) import Common.Annex -import Utility.CopyFile import Types.Remote import qualified Git import Config @@ -231,11 +230,11 @@ storeHelper d chunksize key a = do tmpprefixlen = length tmpprefix retrieve :: FilePath -> ChunkSize -> Key -> FilePath -> Annex Bool -retrieve d chunksize k f = liftIO $ withStoredFiles chunksize d k go - where - go [file] = copyFileExternal file f - go files = catchBoolIO $ do - L.writeFile f =<< (L.concat <$> mapM L.readFile files) +retrieve d chunksize k f = metered k $ \meterupdate -> + liftIO $ withStoredFiles chunksize d k $ \files -> + catchBoolIO $ do + meteredWriteFile meterupdate f =<< + (L.concat <$> mapM L.readFile files) return True retrieveEncrypted :: FilePath -> ChunkSize -> (Cipher, Key) -> FilePath -> Annex Bool |