summaryrefslogtreecommitdiffhomepage
path: root/Storage/Local.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Storage/Local.hs')
-rw-r--r--Storage/Local.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/Storage/Local.hs b/Storage/Local.hs
index 6a952fa..90da7b8 100644
--- a/Storage/Local.hs
+++ b/Storage/Local.hs
@@ -6,6 +6,7 @@
module Storage.Local
( localStorage
, storageDir
+ , storageTopDir
, testStorageDir
, localDiskUsage
) where
@@ -147,13 +148,14 @@ storageDir Nothing (Section section) = do
storageDir (Just (LocalStorageDirectory d)) (Section section) =
pure $ d </> section
+storageTopDir :: Maybe LocalStorageDirectory -> IO FilePath
+storageTopDir lsd = storageDir lsd (Section ".")
+
testStorageDir :: FilePath -> GetShareDir
testStorageDir tmpdir = storageDir (Just (LocalStorageDirectory tmpdir))
localDiskUsage :: Maybe LocalStorageDirectory -> IO DiskUsage
-localDiskUsage lsd = do
- dir <- storageDir lsd (Section ".")
- getDiskUsage dir
+localDiskUsage lsd = getDiskUsage =<< storageTopDir lsd
-- | The takeFileName ensures that, if the StorableObjectIdent somehow
-- contains a path (eg starts with "../" or "/"), it is not allowed