[ox/fs] Add FileSystem::exists

(synced from af634bd4e5)
This commit is contained in:
2024-05-27 00:44:58 -05:00
parent 1ff2cd7c41
commit 6a4c68e783
+15
View File
@@ -99,6 +99,21 @@ class FileSystem {
Result<FileStat> stat(const FileAddress &addr) const noexcept;
[[nodiscard]]
inline bool exists(uint64_t inode) const noexcept {
return statInode(inode).ok();
}
[[nodiscard]]
inline bool exists(ox::StringView path) const noexcept {
return statPath(path).ok();
}
[[nodiscard]]
inline bool exists(FileAddress const&addr) const noexcept {
return stat(addr).ok();
}
[[nodiscard]]
virtual uint64_t spaceNeeded(uint64_t size) const noexcept = 0;