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.
This commit is contained in:
parent
99a99b3f65
commit
625303226d
4 changed files with 28 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue