finish fixing removeLink on windows
9cb250f7be
got the ones in RawFilePath,
but there were others that used the one from unix-compat, which fails at
runtime on windows. To avoid this,
import System.PosixCompat.Files hiding removeLink
This commit was sponsored by Ethan Aubin.
This commit is contained in:
parent
dce0781391
commit
a3b714ddd9
28 changed files with 73 additions and 64 deletions
|
@ -301,10 +301,10 @@ retrieveExportM d _k loc dest p =
|
|||
|
||||
removeExportM :: RawFilePath -> Key -> ExportLocation -> Annex ()
|
||||
removeExportM d _k loc = liftIO $ do
|
||||
removeWhenExistsWith removeLink src
|
||||
removeWhenExistsWith R.removeLink src
|
||||
removeExportLocation d loc
|
||||
where
|
||||
src = fromRawFilePath $ exportPath d loc
|
||||
src = exportPath d loc
|
||||
|
||||
checkPresentExportM :: RawFilePath -> Key -> ExportLocation -> Annex Bool
|
||||
checkPresentExportM d _k loc =
|
||||
|
|
|
@ -22,6 +22,7 @@ import qualified Remote.Helper.Chunked.Legacy as Legacy
|
|||
import Annex.Tmp
|
||||
import Utility.Metered
|
||||
import Utility.Directory.Create
|
||||
import qualified Utility.RawFilePath as R
|
||||
|
||||
withCheckedFiles :: (FilePath -> IO Bool) -> FilePath -> (FilePath -> Key -> [FilePath]) -> Key -> ([FilePath] -> IO Bool) -> IO Bool
|
||||
withCheckedFiles _ [] _locations _ _ = return False
|
||||
|
@ -98,15 +99,15 @@ store repotop chunksize finalizer k b p = storeHelper repotop finalizer k $ \des
|
|||
retrieve :: (RawFilePath -> Key -> [RawFilePath]) -> RawFilePath -> Retriever
|
||||
retrieve locations d basek p c = withOtherTmp $ \tmpdir -> do
|
||||
showLongNote "This remote uses the deprecated chunksize setting. So this will be quite slow."
|
||||
let tmp = fromRawFilePath $
|
||||
tmpdir P.</> keyFile basek <> ".directorylegacy.tmp"
|
||||
let tmp = tmpdir P.</> keyFile basek <> ".directorylegacy.tmp"
|
||||
let tmp' = fromRawFilePath tmp
|
||||
let go = \k sink -> do
|
||||
liftIO $ void $ withStoredFiles (fromRawFilePath d) (legacyLocations locations) k $ \fs -> do
|
||||
forM_ fs $
|
||||
S.appendFile tmp <=< S.readFile
|
||||
S.appendFile tmp' <=< S.readFile
|
||||
return True
|
||||
b <- liftIO $ L.readFile tmp
|
||||
liftIO $ removeWhenExistsWith removeLink tmp
|
||||
b <- liftIO $ L.readFile tmp'
|
||||
liftIO $ removeWhenExistsWith R.removeLink tmp
|
||||
sink b
|
||||
byteRetriever go basek p c
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ import Messages.Progress
|
|||
import qualified Git
|
||||
import qualified Git.Construct
|
||||
import Git.Types
|
||||
import qualified Utility.RawFilePath as R
|
||||
|
||||
import qualified Data.ByteString as S
|
||||
import qualified Data.ByteString.Lazy as L
|
||||
|
@ -284,10 +285,10 @@ sink dest enc c mh mp content = case (enc, mh, content) of
|
|||
withBytes content $ \b ->
|
||||
decrypt cmd c cipher (feedBytes b) $
|
||||
readBytes write
|
||||
liftIO $ removeWhenExistsWith removeLink f
|
||||
liftIO $ removeWhenExistsWith R.removeLink (toRawFilePath f)
|
||||
(Nothing, _, FileContent f) -> do
|
||||
withBytes content write
|
||||
liftIO $ removeWhenExistsWith removeLink f
|
||||
liftIO $ removeWhenExistsWith R.removeLink (toRawFilePath f)
|
||||
(Nothing, _, ByteContent b) -> write b
|
||||
where
|
||||
write b = case mh of
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue