use RawFilePath version of rename
Some small wins, almost certianly swamped by the system calls, but still worthwhile progress on the RawFilePath conversion. Sponsored-by: Erik Bjäreholt on Patreon
This commit is contained in:
parent
d00e23cac9
commit
debcf86029
16 changed files with 58 additions and 54 deletions
|
@ -75,13 +75,13 @@ replaceFile' createdirectory file checkres action = withOtherTmp $ \othertmpdir
|
|||
let tmpfile = tmpdir </> basetmp
|
||||
r <- action tmpfile
|
||||
when (checkres r) $
|
||||
replaceFileFrom tmpfile file createdirectory
|
||||
replaceFileFrom (toRawFilePath tmpfile) (toRawFilePath file) createdirectory
|
||||
return r
|
||||
|
||||
replaceFileFrom :: FilePath -> FilePath -> (RawFilePath -> Annex ()) -> Annex ()
|
||||
replaceFileFrom :: RawFilePath -> RawFilePath -> (RawFilePath -> Annex ()) -> Annex ()
|
||||
replaceFileFrom src dest createdirectory = go `catchIO` fallback
|
||||
where
|
||||
go = liftIO $ moveFile src dest
|
||||
fallback _ = do
|
||||
createdirectory (parentDir (toRawFilePath dest))
|
||||
createdirectory (parentDir dest)
|
||||
go
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue