This commit is contained in:
Joey Hess 2019-03-05 14:50:39 -04:00
parent 8c54604e67
commit bec66258a8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -392,13 +392,7 @@ storeExportWithContentIdentifierM :: FilePath -> FilePath -> Key -> ExportLocati
storeExportWithContentIdentifierM dir src _k loc overwritablecids p =
catchDefaultIO Nothing $ do
liftIO $ createDirectoryIfMissing True destdir
docopy
where
dest = exportPath dir loc
(destdir, base) = splitFileName dest
template = relatedTemplate (base ++ ".tmp")
docopy = withTmpFileIn destdir template $ \tmpf tmph -> do
withTmpFileIn destdir template $ \tmpf tmph -> do
liftIO $ withMeteredFile src p (L.hPut tmph)
liftIO $ hFlush tmph
liftIO (getFileStatus tmpf) >>= liftIO . mkContentIdentifier tmpf >>= \case
@ -407,6 +401,10 @@ storeExportWithContentIdentifierM dir src _k loc overwritablecids p =
checkExportContent dir loc (newcid:overwritablecids) Nothing $ do
liftIO $ rename tmpf dest
return (Just newcid)
where
dest = exportPath dir loc
(destdir, base) = splitFileName dest
template = relatedTemplate (base ++ ".tmp")
removeExportWithContentIdentifierM :: FilePath -> Key -> ExportLocation -> [ContentIdentifier] -> Annex Bool
removeExportWithContentIdentifierM dir k loc removeablecids =