minor
This commit is contained in:
parent
8c54604e67
commit
bec66258a8
1 changed files with 9 additions and 11 deletions
|
@ -392,22 +392,20 @@ storeExportWithContentIdentifierM :: FilePath -> FilePath -> Key -> ExportLocati
|
||||||
storeExportWithContentIdentifierM dir src _k loc overwritablecids p =
|
storeExportWithContentIdentifierM dir src _k loc overwritablecids p =
|
||||||
catchDefaultIO Nothing $ do
|
catchDefaultIO Nothing $ do
|
||||||
liftIO $ createDirectoryIfMissing True destdir
|
liftIO $ createDirectoryIfMissing True destdir
|
||||||
docopy
|
withTmpFileIn destdir template $ \tmpf tmph -> do
|
||||||
|
liftIO $ withMeteredFile src p (L.hPut tmph)
|
||||||
|
liftIO $ hFlush tmph
|
||||||
|
liftIO (getFileStatus tmpf) >>= liftIO . mkContentIdentifier tmpf >>= \case
|
||||||
|
Nothing -> return Nothing
|
||||||
|
Just newcid ->
|
||||||
|
checkExportContent dir loc (newcid:overwritablecids) Nothing $ do
|
||||||
|
liftIO $ rename tmpf dest
|
||||||
|
return (Just newcid)
|
||||||
where
|
where
|
||||||
dest = exportPath dir loc
|
dest = exportPath dir loc
|
||||||
(destdir, base) = splitFileName dest
|
(destdir, base) = splitFileName dest
|
||||||
template = relatedTemplate (base ++ ".tmp")
|
template = relatedTemplate (base ++ ".tmp")
|
||||||
|
|
||||||
docopy = withTmpFileIn destdir template $ \tmpf tmph -> do
|
|
||||||
liftIO $ withMeteredFile src p (L.hPut tmph)
|
|
||||||
liftIO $ hFlush tmph
|
|
||||||
liftIO (getFileStatus tmpf) >>= liftIO . mkContentIdentifier tmpf >>= \case
|
|
||||||
Nothing -> return Nothing
|
|
||||||
Just newcid ->
|
|
||||||
checkExportContent dir loc (newcid:overwritablecids) Nothing $ do
|
|
||||||
liftIO $ rename tmpf dest
|
|
||||||
return (Just newcid)
|
|
||||||
|
|
||||||
removeExportWithContentIdentifierM :: FilePath -> Key -> ExportLocation -> [ContentIdentifier] -> Annex Bool
|
removeExportWithContentIdentifierM :: FilePath -> Key -> ExportLocation -> [ContentIdentifier] -> Annex Bool
|
||||||
removeExportWithContentIdentifierM dir k loc removeablecids =
|
removeExportWithContentIdentifierM dir k loc removeablecids =
|
||||||
checkExportContent dir loc removeablecids False $
|
checkExportContent dir loc removeablecids False $
|
||||||
|
|
Loading…
Reference in a new issue