use createAnnexDirectory when setting up tmp dir

This commit is contained in:
Joey Hess 2012-06-05 20:25:32 -04:00
parent f8d422fe24
commit 5809f33f8b
2 changed files with 4 additions and 1 deletions

View file

@ -16,6 +16,7 @@ import qualified Types.Backend
import qualified Types.Key import qualified Types.Key
import qualified Backend import qualified Backend
import Annex.Content import Annex.Content
import Annex.Perms
import Logs.Location import Logs.Location
import Logs.Trust import Logs.Trust
import Annex.UUID import Annex.UUID
@ -83,8 +84,8 @@ performRemote key file backend numcopies remote =
withtmp a = do withtmp a = do
pid <- liftIO getProcessID pid <- liftIO getProcessID
t <- fromRepo gitAnnexTmpDir t <- fromRepo gitAnnexTmpDir
createAnnexDirectory t
let tmp = t </> "fsck" ++ show pid ++ "." ++ keyFile key let tmp = t </> "fsck" ++ show pid ++ "." ++ keyFile key
liftIO $ createDirectoryIfMissing True t
let cleanup = liftIO $ catchIO (removeFile tmp) (const noop) let cleanup = liftIO $ catchIO (removeFile tmp) (const noop)
cleanup cleanup
cleanup `after` a tmp cleanup `after` a tmp

View file

@ -19,6 +19,7 @@ import Remote.Helper.Special
import Remote.Helper.Encryptable import Remote.Helper.Encryptable
import Crypto import Crypto
import Utility.RsyncFile import Utility.RsyncFile
import Annex.Perms
type RsyncUrl = String type RsyncUrl = String
@ -176,6 +177,7 @@ withRsyncScratchDir :: (FilePath -> Annex Bool) -> Annex Bool
withRsyncScratchDir a = do withRsyncScratchDir a = do
pid <- liftIO getProcessID pid <- liftIO getProcessID
t <- fromRepo gitAnnexTmpDir t <- fromRepo gitAnnexTmpDir
createAnnexDirectory t
let tmp = t </> "rsynctmp" </> show pid let tmp = t </> "rsynctmp" </> show pid
nuke tmp nuke tmp
liftIO $ createDirectoryIfMissing True tmp liftIO $ createDirectoryIfMissing True tmp