From 7eaa7b36c040a9dfc2bdaede84a8d41f5f3646b7 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Mon, 27 May 2024 00:44:58 -0500 Subject: [PATCH] [ox/fs] Add FileSystem::exists --- .../deps/ox/src/ox/fs/filesystem/filesystem.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/filesystem.hpp b/deps/nostalgia/deps/ox/src/ox/fs/filesystem/filesystem.hpp index 5cef155..c39f556 100644 --- a/deps/nostalgia/deps/ox/src/ox/fs/filesystem/filesystem.hpp +++ b/deps/nostalgia/deps/ox/src/ox/fs/filesystem/filesystem.hpp @@ -99,6 +99,21 @@ class FileSystem { Result 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;