diff options
author | 2017-09-18 13:57:25 -0400 | |
---|---|---|
committer | 2017-09-18 13:59:59 -0400 | |
commit | a5e968bb8d4c608c33463160ea2b583a3e34b8fc (patch) | |
tree | ffd59e071fadf718ed4f270d2cf2b67fda9b6315 /Remote/Directory.hs | |
parent | 9d2ac4d87dc98bd2ab60da38a7e98f0964fd1595 (diff) |
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.
Diffstat (limited to 'Remote/Directory.hs')
-rw-r--r-- | Remote/Directory.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Remote/Directory.hs b/Remote/Directory.hs index 2d2daff39..406af0fdc 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -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')) |