aboutsummaryrefslogtreecommitdiff
path: root/zencore/include
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2021-12-05 19:04:39 +0100
committerPer Larsson <[email protected]>2021-12-05 19:04:39 +0100
commit69c33063aaa85abf153bea036c58937067a80cd5 (patch)
tree6c13f9c8095e727213cf754d274694af05afb3ce /zencore/include
parentAdded simple GC interval scheduling. (diff)
downloadzen-69c33063aaa85abf153bea036c58937067a80cd5.tar.xz
zen-69c33063aaa85abf153bea036c58937067a80cd5.zip
Check available disk space before GC.
Diffstat (limited to 'zencore/include')
-rw-r--r--zencore/include/zencore/filesystem.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/zencore/include/zencore/filesystem.h b/zencore/include/zencore/filesystem.h
index c7ac7140d..155291e67 100644
--- a/zencore/include/zencore/filesystem.h
+++ b/zencore/include/zencore/filesystem.h
@@ -57,6 +57,22 @@ ZENCORE_API bool SupportsBlockRefCounting(std::filesystem::path Path);
ZENCORE_API std::string ToUtf8(const std::filesystem::path& Path);
+struct DiskSpace
+{
+ uint64_t Free{};
+ uint64_t Total{};
+};
+
+ZENCORE_API DiskSpace DiskSpaceInfo(std::filesystem::path Directory, std::error_code& Error);
+
+inline bool
+DiskSpaceInfo(std::filesystem::path Directory, DiskSpace& Space)
+{
+ std::error_code Err;
+ Space = DiskSpaceInfo(Directory, Err);
+ return !!Err;
+}
+
/**
* Efficient file system traversal
*