diff options
author | 2015-01-09 13:11:56 -0400 | |
---|---|---|
committer | 2015-01-09 13:11:56 -0400 | |
commit | 425bc1107aebdb701cdcee44da731dd918cd470d (patch) | |
tree | 25bcacb37277b70aa7bd0caaf0fe7c3edc665653 /Command | |
parent | 20c7644a4d85434cf49840ea92fca0c723710c72 (diff) |
revert parentDir change
Reverts 2bba5bc22d049272d3328bfa6c452d3e2e50e86c
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.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/AddUrl.hs | 8 | ||||
-rw-r--r-- | Command/Fix.hs | 2 | ||||
-rw-r--r-- | Command/FromKey.hs | 2 | ||||
-rw-r--r-- | Command/Fsck.hs | 10 | ||||
-rw-r--r-- | Command/FuzzTest.hs | 4 | ||||
-rw-r--r-- | Command/Import.hs | 2 | ||||
-rw-r--r-- | Command/ImportFeed.hs | 2 | ||||
-rw-r--r-- | Command/Unlock.hs | 2 | ||||
-rw-r--r-- | Command/Vicfg.hs | 2 |
9 files changed, 17 insertions, 17 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs index a5fa53ca0..97adc75ee 100644 --- a/Command/AddUrl.hs +++ b/Command/AddUrl.hs @@ -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. diff --git a/Command/Fix.hs b/Command/Fix.hs index 956ea4352..774ef8583 100644 --- a/Command/Fix.hs +++ b/Command/Fix.hs @@ -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 diff --git a/Command/FromKey.hs b/Command/FromKey.hs index 96da895ed..3b20749fe 100644 --- a/Command/FromKey.hs +++ b/Command/FromKey.hs @@ -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 diff --git a/Command/Fsck.hs b/Command/Fsck.hs index 837e68ea8..46c1620f1 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -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 diff --git a/Command/FuzzTest.hs b/Command/FuzzTest.hs index a2a474d31..87bee963f 100644 --- a/Command/FuzzTest.hs +++ b/Command/FuzzTest.hs @@ -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 diff --git a/Command/Import.hs b/Command/Import.hs index 113df19ac..b20e63853 100644 --- a/Command/Import.hs +++ b/Command/Import.hs @@ -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 diff --git a/Command/ImportFeed.hs b/Command/ImportFeed.hs index 05dc4f3e4..c45fad961 100644 --- a/Command/ImportFeed.hs +++ b/Command/ImportFeed.hs @@ -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 diff --git a/Command/Unlock.hs b/Command/Unlock.hs index 75df99332..56c4f1dc0 100644 --- a/Command/Unlock.hs +++ b/Command/Unlock.hs @@ -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 diff --git a/Command/Vicfg.hs b/Command/Vicfg.hs index 12a6084bd..8fc10deb5 100644 --- a/Command/Vicfg.hs +++ b/Command/Vicfg.hs @@ -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 |