[ox/fs] Add FileSystem::exists

This commit is contained in:
Gary Talent 2024-05-27 00:44:58 -05:00
parent 49b859ecf5
commit af634bd4e5

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;