diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-07-07 14:48:23 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-07-07 14:48:23 -0400 |
commit | d9cbdf43fe6ce971d9b5a99e60a70055f67b1ed3 (patch) | |
tree | 540a849d67b0ab43c981dc4a93432743be1054b3 /Command | |
parent | 734d7e8360b09b80f943140186911d47dc5db735 (diff) |
import: Fix failure of cross-device import on Windows.
As well as import, 2 other places ran "mv" manually, so changed them to use
moveFile as well.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Reinject.hs | 6 | ||||
-rw-r--r-- | Command/SetKey.hs | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/Command/Reinject.hs b/Command/Reinject.hs index 2c785feb6..de7f6eb3d 100644 --- a/Command/Reinject.hs +++ b/Command/Reinject.hs @@ -50,11 +50,13 @@ perform src dest key = do ) where -- the file might be on a different filesystem, - -- so mv is used rather than simply calling + -- so moveFile is used rather than simply calling -- moveToObjectDir; disk space is also -- checked this way. move = getViaTmp key $ \tmp -> - liftIO $ boolSystem "mv" [File src, File tmp] + liftIO $ catchBoolIO $ do + moveFile src tmp + return True reject = const $ return "wrong file?" cleanup :: Key -> CommandCleanup diff --git a/Command/SetKey.hs b/Command/SetKey.hs index 02118fb14..d5762dd8c 100644 --- a/Command/SetKey.hs +++ b/Command/SetKey.hs @@ -31,13 +31,14 @@ mkKey = fromMaybe (error "bad key") . file2key perform :: FilePath -> Key -> CommandPerform perform file key = do - -- the file might be on a different filesystem, so mv is used + -- the file might be on a different filesystem, so moveFile is used -- rather than simply calling moveAnnex; disk space is also -- checked this way. ok <- getViaTmp key $ \dest -> if dest /= file - then liftIO $ - boolSystem "mv" [File file, File dest] + then liftIO $ catchBoolIO $ do + moveFile file dest + return True else return True if ok then next $ cleanup key |