add ExportTree table to export db
New table needed to look up what filenames are used in the currently exported tree, for reasons explained in export.mdwn. Also, added smart constructors for ExportLocation and ExportDirectory to make sure they contain filepaths with the right direction slashes. And some code refactoring. This commit was sponsored by Francois Marier on Patreon.
This commit is contained in:
parent
486902389d
commit
b03d77c211
13 changed files with 247 additions and 93 deletions
|
@ -274,14 +274,14 @@ renameExportM d _k oldloc newloc = liftIO $ catchBoolIO $ do
|
|||
dest = exportPath d newloc
|
||||
|
||||
exportPath :: FilePath -> ExportLocation -> FilePath
|
||||
exportPath d (ExportLocation loc) = d </> loc
|
||||
exportPath d loc = d </> fromExportLocation loc
|
||||
|
||||
{- Removes the ExportLocation directory and its parents, so long as
|
||||
- they're empty, up to but not including the topdir. -}
|
||||
removeExportLocation :: FilePath -> ExportLocation -> IO ()
|
||||
removeExportLocation topdir (ExportLocation loc) = go (Just loc) (Right ())
|
||||
removeExportLocation topdir loc = go (Just $ fromExportLocation loc) (Right ())
|
||||
where
|
||||
go _ (Left _e) = return ()
|
||||
go Nothing _ = return ()
|
||||
go (Just loc') _ = go (upFrom loc')
|
||||
=<< tryIO (removeDirectory $ exportPath topdir (ExportLocation loc'))
|
||||
=<< tryIO (removeDirectory $ exportPath topdir (mkExportLocation loc'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue