Remaining things needing converted are in the assistant, and Annex.Ssh.
Every other remaining call to createDirectoryIfMissing True has been
audited and is not relevant. The ones in Build/ of course don't get
included in the program. Others included eg, Remote.Tahoe and
Config.Files which both write to dotfiles under the home directory.
import Annex.Content
import Annex.Ingest
import Annex.CheckIgnore
+import Annex.Perms
import Annex.UUID
import Annex.YoutubeDl
import Logs.Web
downloadRemoteFile :: AddUnlockedMatcher -> Remote -> DownloadOptions -> URLString -> FilePath -> Maybe Integer -> Annex (Maybe Key)
downloadRemoteFile addunlockedmatcher r o uri file sz = checkCanAdd file $ do
let urlkey = Backend.URL.fromUrl uri sz
- liftIO $ createDirectoryIfMissing True (parentDir file)
+ createWorkTreeDirectory (parentDir file)
ifM (Annex.getState Annex.fast <||> pure (relaxedOption o))
( do
addWorkTree addunlockedmatcher (Remote.uuid r) loguri file urlkey Nothing
)
normalfinish tmp = checkCanAdd file $ do
showDestinationFile file
- liftIO $ createDirectoryIfMissing True (parentDir file)
+ createWorkTreeDirectory (parentDir file)
finishDownloadWith addunlockedmatcher tmp webUUID url file
tryyoutubedl tmp
-- Ask youtube-dl what filename it will download
tmp <- fromRepo $ gitAnnexTmpObjectLocation dummykey
ok <- Transfer.notifyTransfer Transfer.Download url $
Transfer.download u dummykey afile Transfer.stdRetry $ \p -> do
- liftIO $ createDirectoryIfMissing True (parentDir tmp)
+ createAnnexDirectory (parentDir tmp)
downloader tmp p
if ok
then return (Just tmp)
Nothing -> go
Just tmp -> do
-- Move to final location for large file check.
- pruneTmpWorkDirBefore tmp $ \_ -> liftIO $ do
- createDirectoryIfMissing True (takeDirectory file)
- renameFile tmp file
+ pruneTmpWorkDirBefore tmp $ \_ -> do
+ createWorkTreeDirectory (takeDirectory file)
+ liftIO $ renameFile tmp file
largematcher <- largeFilesMatcher
large <- checkFileMatcher largematcher file
if large
nodownloadWeb' :: AddUnlockedMatcher -> URLString -> Key -> FilePath -> Annex (Maybe Key)
nodownloadWeb' addunlockedmatcher url key file = checkCanAdd file $ do
showDestinationFile file
- liftIO $ createDirectoryIfMissing True (parentDir file)
+ createWorkTreeDirectory (parentDir file)
addWorkTree addunlockedmatcher webUUID url file key Nothing
return (Just key)
mtime <- catchMaybeIO $ modificationTimeHiRes
<$> getSymbolicLinkStatus file
#endif
- createDirectoryIfMissing True (parentDir file)
+ createWorkTreeDirectory (parentDir file)
removeFile file
createSymbolicLink link file
#if ! defined(mingw32_HOST_OS)
import qualified Annex.Queue
import Annex.Content
import Annex.WorkTree
+import Annex.Perms
import qualified Annex
import qualified Backend.URL
( hasothercontent
, do
link <- calcRepo $ gitAnnexLink file key
- liftIO $ createDirectoryIfMissing True (parentDir file)
+ createWorkTreeDirectory (parentDir file)
liftIO $ createSymbolicLink link file
Annex.Queue.addCommand "add" [Param "--"] [file]
next $ return True
go want have
| want /= fromRawFilePath (fromInternalGitPath have) = do
showNote "fixing link"
- liftIO $ createDirectoryIfMissing True (parentDir (fromRawFilePath file))
+ liftIO $ createWorkTreeDirectory (parentDir (fromRawFilePath file))
liftIO $ removeFile (fromRawFilePath file)
addAnnexLink want file
| otherwise = noop
import qualified Annex
import qualified Git.Config
import Config
+import Annex.Perms
import Utility.ThreadScheduler
import Utility.DiskFree
import Git.Types (fromConfigKey)
]
runFuzzAction :: FuzzAction -> Annex ()
-runFuzzAction (FuzzAdd (FuzzFile f)) = liftIO $ do
- createDirectoryIfMissing True $ parentDir f
- n <- getStdRandom random :: IO Int
- writeFile f $ show n ++ "\n"
+runFuzzAction (FuzzAdd (FuzzFile f)) = do
+ createWorkTreeDirectory (parentDir f)
+ n <- liftIO (getStdRandom random :: IO Int)
+ liftIO $ writeFile f $ show n ++ "\n"
runFuzzAction (FuzzDelete (FuzzFile f)) = liftIO $ nukeFile f
runFuzzAction (FuzzMove (FuzzFile src) (FuzzFile dest)) = liftIO $
rename src dest
import Annex.Ingest
import Annex.InodeSentinal
import Annex.Import
+import Annex.Perms
import Annex.RemoteTrackingBranch
import Utility.InodeCache
import Logs.Location
importfilechecked ld k = do
-- Move or copy the src file to the dest file.
-- The dest file is what will be ingested.
- liftIO $ createDirectoryIfMissing True (parentDir destfile)
+ createWorkTreeDirectory (parentDir destfile)
liftIO $ if mode == Duplicate || mode == SkipDuplicates
then void $ copyFileExternal CopyAllMetaData srcfile destfile
else moveFile srcfile destfile
-- Get the inode cache of the dest file. It should be
- -- weakly the same as the origianlly locked down file's
+ -- weakly the same as the originally locked down file's
-- inode cache. (Since the file may have been copied,
-- its inodes may not be the same.)
newcache <- withTSDelta $ liftIO . genInodeCache destfile'
import Annex.Common
import Annex.Perms
import Utility.FileMode
-import Utility.Directory
import Database.Persist.Sqlite
import Control.Monad.IO.Class (liftIO)
nukeFile f
where
makeref (sha, ref) = do
- let dest = fromRawFilePath (localGitDir r) </> fromRef ref
- createDirectoryIfMissing True (parentDir dest)
+ let gitd = fromRawFilePath (localGitDir r)
+ let dest = gitd </> fromRef ref
+ createDirectoryUnder gitd (parentDir dest)
unlessM (doesFileExist dest) $
writeFile dest (fromRef sha)
import Utility.Metered
import Annex.UUID
import Annex.Ssh
+import Annex.Perms
import qualified Remote.Rsync
import qualified Remote.Directory
import Utility.Rsync
- which is needed for direct rsync of objects to work.
-}
rsyncsetup = Remote.Rsync.withRsyncScratchDir $ \tmp -> do
- liftIO $ createDirectoryIfMissing True $ tmp </> objectDir
+ createAnnexDirectory (tmp </> objectDir)
dummycfg <- liftIO dummyRemoteGitConfig
(rsynctransport, rsyncurl, _) <- rsyncTransport r dummycfg
let tmpconfig = tmp </> "config"
| not $ Git.repoIsUrl repo =
byteStorer $ \k b p -> guardUsable repo (return False) $ liftIO $ do
let tmpdir = Git.repoLocation repo </> "tmp" </> fromRawFilePath (keyFile k)
- void $ tryIO $ createDirectoryIfMissing True tmpdir
+ void $ tryIO $ createDirectoryUnder (Git.repoLocation repo) tmpdir
let tmpf = tmpdir </> fromRawFilePath (keyFile k)
meteredWriteFile p tmpf b
let destdir = parentDir $ gCryptLocation repo k
import Annex.Content
import Annex.UUID
import Annex.Ssh
+import Annex.Perms
import Remote.Helper.Special
import Remote.Helper.Messages
import Remote.Helper.ExportImport
storeGeneric :: RsyncOpts -> MeterUpdate -> FilePath -> (FilePath -> Annex Bool) -> Annex Bool
storeGeneric o meterupdate basedest populatedest = withRsyncScratchDir $ \tmp -> do
let dest = tmp </> basedest
- liftIO $ createDirectoryIfMissing True $ parentDir dest
+ createAnnexDirectory (parentDir dest)
ok <- populatedest dest
ps <- sendParams
if ok
import Annex.Common
import Annex.Content
import Annex.Link
+import Annex.Perms
import Types.Key
import Logs.Presence
import qualified Annex.Queue
dest <- fromRepo $ logFile2 k
dir <- fromRepo Upgrade.V2.gitStateDir
let f = dir </> l
- liftIO $ createDirectoryIfMissing True (parentDir dest)
+ createWorkTreeDirectory (parentDir dest)
-- could just git mv, but this way deals with
-- log files that are not checked into git,
-- as well as merging with already upgraded