revert parentDir change
Reverts 965e106f24
Unfortunately, this caused breakage on Windows, and possibly elsewhere,
because parentDir and takeDirectory do not behave the same when there is a
trailing directory separator.
This commit is contained in:
parent
2fff78512d
commit
3bab5dfb1d
47 changed files with 99 additions and 96 deletions
|
@ -101,7 +101,7 @@ performRemote r relaxed uri file sz = ifAnnexed file adduri geturi
|
|||
downloadRemoteFile :: Remote -> Bool -> URLString -> FilePath -> Maybe Integer -> Annex (Maybe Key)
|
||||
downloadRemoteFile r relaxed uri file sz = do
|
||||
urlkey <- Backend.URL.fromUrl uri sz
|
||||
liftIO $ createDirectoryIfMissing True (takeDirectory file)
|
||||
liftIO $ createDirectoryIfMissing True (parentDir file)
|
||||
ifM (Annex.getState Annex.fast <||> pure relaxed)
|
||||
( do
|
||||
cleanup (Remote.uuid r) loguri file urlkey Nothing
|
||||
|
@ -195,7 +195,7 @@ addUrlFileQuvi relaxed quviurl videourl file = do
|
|||
showOutput
|
||||
ok <- Transfer.notifyTransfer Transfer.Download (Just file) $
|
||||
Transfer.download webUUID key (Just file) Transfer.forwardRetry $ const $ do
|
||||
liftIO $ createDirectoryIfMissing True (takeDirectory tmp)
|
||||
liftIO $ createDirectoryIfMissing True (parentDir tmp)
|
||||
downloadUrl [videourl] tmp
|
||||
if ok
|
||||
then do
|
||||
|
@ -227,7 +227,7 @@ addUrlChecked relaxed url u checkexistssize key
|
|||
|
||||
addUrlFile :: Bool -> URLString -> FilePath -> Annex (Maybe Key)
|
||||
addUrlFile relaxed url file = do
|
||||
liftIO $ createDirectoryIfMissing True (takeDirectory file)
|
||||
liftIO $ createDirectoryIfMissing True (parentDir file)
|
||||
ifM (Annex.getState Annex.fast <||> pure relaxed)
|
||||
( nodownload relaxed url file
|
||||
, downloadWeb url file
|
||||
|
@ -269,7 +269,7 @@ downloadWith downloader dummykey u url file =
|
|||
where
|
||||
runtransfer tmp = Transfer.notifyTransfer Transfer.Download (Just file) $
|
||||
Transfer.download u dummykey (Just file) Transfer.forwardRetry $ \p -> do
|
||||
liftIO $ createDirectoryIfMissing True (takeDirectory tmp)
|
||||
liftIO $ createDirectoryIfMissing True (parentDir tmp)
|
||||
downloader tmp p
|
||||
|
||||
{- Hits the url to get the size, if available.
|
||||
|
|
|
@ -43,7 +43,7 @@ perform file link = do
|
|||
<$> getSymbolicLinkStatus file
|
||||
#endif
|
||||
#endif
|
||||
createDirectoryIfMissing True (takeDirectory file)
|
||||
createDirectoryIfMissing True (parentDir file)
|
||||
removeFile file
|
||||
createSymbolicLink link file
|
||||
#ifdef WITH_CLIBS
|
||||
|
|
|
@ -34,7 +34,7 @@ start _ = error "specify a key and a dest file"
|
|||
perform :: Key -> FilePath -> CommandPerform
|
||||
perform key file = do
|
||||
link <- inRepo $ gitAnnexLink file key
|
||||
liftIO $ createDirectoryIfMissing True (takeDirectory file)
|
||||
liftIO $ createDirectoryIfMissing True (parentDir file)
|
||||
liftIO $ createSymbolicLink link file
|
||||
next $ cleanup file
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ fixLink key file = do
|
|||
go want have
|
||||
| want /= fromInternalGitPath have = do
|
||||
showNote "fixing link"
|
||||
liftIO $ createDirectoryIfMissing True (takeDirectory file)
|
||||
liftIO $ createDirectoryIfMissing True (parentDir file)
|
||||
liftIO $ removeFile file
|
||||
addAnnexLink want file
|
||||
| otherwise = noop
|
||||
|
@ -218,7 +218,7 @@ verifyLocationLog key desc = do
|
|||
file <- calcRepo $ gitAnnexLocation key
|
||||
when (present && not direct) $
|
||||
freezeContent file
|
||||
whenM (liftIO $ doesDirectoryExist $ takeDirectory file) $
|
||||
whenM (liftIO $ doesDirectoryExist $ parentDir file) $
|
||||
freezeContentDir file
|
||||
|
||||
{- In direct mode, modified files will show up as not present,
|
||||
|
@ -450,7 +450,7 @@ needFsck _ _ = return True
|
|||
-}
|
||||
recordFsckTime :: Key -> Annex ()
|
||||
recordFsckTime key = do
|
||||
parent <- takeDirectory <$> calcRepo (gitAnnexLocation key)
|
||||
parent <- parentDir <$> calcRepo (gitAnnexLocation key)
|
||||
liftIO $ void $ tryIO $ do
|
||||
touchFile parent
|
||||
#ifndef mingw32_HOST_OS
|
||||
|
@ -459,7 +459,7 @@ recordFsckTime key = do
|
|||
|
||||
getFsckTime :: Key -> Annex (Maybe EpochTime)
|
||||
getFsckTime key = do
|
||||
parent <- takeDirectory <$> calcRepo (gitAnnexLocation key)
|
||||
parent <- parentDir <$> calcRepo (gitAnnexLocation key)
|
||||
liftIO $ catchDefaultIO Nothing $ do
|
||||
s <- getFileStatus parent
|
||||
return $ if isSticky $ fileMode s
|
||||
|
@ -477,7 +477,7 @@ getFsckTime key = do
|
|||
recordStartTime :: Annex ()
|
||||
recordStartTime = do
|
||||
f <- fromRepo gitAnnexFsckState
|
||||
createAnnexDirectory $ takeDirectory f
|
||||
createAnnexDirectory $ parentDir f
|
||||
liftIO $ do
|
||||
nukeFile f
|
||||
withFile f WriteMode $ \h -> do
|
||||
|
|
|
@ -173,7 +173,7 @@ instance Arbitrary FuzzAction where
|
|||
|
||||
runFuzzAction :: FuzzAction -> Annex ()
|
||||
runFuzzAction (FuzzAdd (FuzzFile f)) = liftIO $ do
|
||||
createDirectoryIfMissing True $ takeDirectory f
|
||||
createDirectoryIfMissing True $ parentDir f
|
||||
n <- getStdRandom random :: IO Int
|
||||
writeFile f $ show n ++ "\n"
|
||||
runFuzzAction (FuzzDelete (FuzzFile f)) = liftIO $ nukeFile f
|
||||
|
@ -210,7 +210,7 @@ genFuzzAction = do
|
|||
case md of
|
||||
Nothing -> genFuzzAction
|
||||
Just d -> do
|
||||
newd <- liftIO $ newDir (takeDirectory $ toFilePath d)
|
||||
newd <- liftIO $ newDir (parentDir $ toFilePath d)
|
||||
maybe genFuzzAction (return . FuzzMoveDir d) newd
|
||||
FuzzDeleteDir _ -> do
|
||||
d <- liftIO existingDir
|
||||
|
|
|
@ -88,7 +88,7 @@ start mode (srcfile, destfile) =
|
|||
next $ return True
|
||||
importfile = do
|
||||
handleexisting =<< liftIO (catchMaybeIO $ getSymbolicLinkStatus destfile)
|
||||
liftIO $ createDirectoryIfMissing True (takeDirectory destfile)
|
||||
liftIO $ createDirectoryIfMissing True (parentDir destfile)
|
||||
liftIO $ if mode == Duplicate || mode == SkipDuplicates
|
||||
then void $ copyFileExternal CopyAllMetaData srcfile destfile
|
||||
else moveFile srcfile destfile
|
||||
|
|
|
@ -311,7 +311,7 @@ checkFeedBroken' url f = do
|
|||
now <- liftIO getCurrentTime
|
||||
case prev of
|
||||
Nothing -> do
|
||||
createAnnexDirectory (takeDirectory f)
|
||||
createAnnexDirectory (parentDir f)
|
||||
liftIO $ writeFile f $ show now
|
||||
return False
|
||||
Just prevtime -> do
|
||||
|
|
|
@ -46,7 +46,7 @@ perform dest key = ifM (checkDiskSpace Nothing key 0)
|
|||
( do
|
||||
src <- calcRepo $ gitAnnexLocation key
|
||||
tmpdest <- fromRepo $ gitAnnexTmpObjectLocation key
|
||||
liftIO $ createDirectoryIfMissing True (takeDirectory tmpdest)
|
||||
liftIO $ createDirectoryIfMissing True (parentDir tmpdest)
|
||||
showAction "copying"
|
||||
ifM (liftIO $ copyFileExternal CopyAllMetaData src tmpdest)
|
||||
( do
|
||||
|
|
|
@ -39,7 +39,7 @@ seek = withNothing start
|
|||
start :: CommandStart
|
||||
start = do
|
||||
f <- fromRepo gitAnnexTmpCfgFile
|
||||
createAnnexDirectory $ takeDirectory f
|
||||
createAnnexDirectory $ parentDir f
|
||||
cfg <- getCfg
|
||||
descs <- uuidDescriptions
|
||||
liftIO $ writeFileAnyEncoding f $ genCfg cfg descs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue