change a few renameFile's to rename
AFAIK, none of these ever operate on directories, but nor do I want to explicitly check if they're files and fail if not.
This commit is contained in:
parent
1669e80e85
commit
070ed4a766
4 changed files with 6 additions and 5 deletions
|
@ -296,7 +296,7 @@ rsyncSend o callback k canrename src = withRsyncScratchDir $ \tmp -> do
|
||||||
liftIO $ createDirectoryIfMissing True $ parentDir dest
|
liftIO $ createDirectoryIfMissing True $ parentDir dest
|
||||||
ok <- liftIO $ if canrename
|
ok <- liftIO $ if canrename
|
||||||
then do
|
then do
|
||||||
renameFile src dest
|
rename src dest
|
||||||
return True
|
return True
|
||||||
else createLinkOrCopy src dest
|
else createLinkOrCopy src dest
|
||||||
ps <- sendParams
|
ps <- sendParams
|
||||||
|
|
|
@ -77,7 +77,7 @@ lockPidFile file = do
|
||||||
#else
|
#else
|
||||||
writeFile newfile "-1"
|
writeFile newfile "-1"
|
||||||
#endif
|
#endif
|
||||||
renameFile newfile file
|
rename newfile file
|
||||||
where
|
where
|
||||||
newfile = file ++ ".new"
|
newfile = file ++ ".new"
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ rotateLog logfile = go 0
|
||||||
| num > maxLogs = return ()
|
| num > maxLogs = return ()
|
||||||
| otherwise = whenM (doesFileExist currfile) $ do
|
| otherwise = whenM (doesFileExist currfile) $ do
|
||||||
go (num + 1)
|
go (num + 1)
|
||||||
renameFile currfile nextfile
|
rename currfile nextfile
|
||||||
where
|
where
|
||||||
currfile = filename num
|
currfile = filename num
|
||||||
nextfile = filename (num + 1)
|
nextfile = filename (num + 1)
|
||||||
|
|
|
@ -13,10 +13,11 @@ import Control.Exception (bracket)
|
||||||
import System.IO
|
import System.IO
|
||||||
import System.Directory
|
import System.Directory
|
||||||
import Control.Monad.IfElse
|
import Control.Monad.IfElse
|
||||||
|
import System.FilePath
|
||||||
|
|
||||||
import Utility.Exception
|
import Utility.Exception
|
||||||
import System.FilePath
|
|
||||||
import Utility.FileSystemEncoding
|
import Utility.FileSystemEncoding
|
||||||
|
import Utility.PosixFiles
|
||||||
|
|
||||||
type Template = String
|
type Template = String
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ viaTmp a file content = do
|
||||||
(tmpfile, handle) <- openTempFile dir (base ++ ".tmp")
|
(tmpfile, handle) <- openTempFile dir (base ++ ".tmp")
|
||||||
hClose handle
|
hClose handle
|
||||||
a tmpfile content
|
a tmpfile content
|
||||||
renameFile tmpfile file
|
rename tmpfile file
|
||||||
|
|
||||||
{- Runs an action with a tmp file located in the system's tmp directory
|
{- Runs an action with a tmp file located in the system's tmp directory
|
||||||
- (or in "." if there is none) then removes the file. -}
|
- (or in "." if there is none) then removes the file. -}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue