#pragma once // IFileSystem - filesystem operations the services need, expressed as a // narrow port. Real implementation is `StdFileSystem` (over ). // In-memory implementation can be plugged in for tests. #include "ccm/util/Result.hpp" #include #include #include namespace ccm { class IFileSystem { public: virtual ~IFileSystem() = default; [[nodiscard]] virtual bool exists(const std::filesystem::path& p) const = 0; [[nodiscard]] virtual bool isDirectory(const std::filesystem::path& p) const = 0; virtual Result ensureDirectory(const std::filesystem::path& p) = 0; virtual Result readText(const std::filesystem::path& p) = 0; virtual Result writeText(const std::filesystem::path& p, std::string_view contents) = 0; virtual Result copyFile(const std::filesystem::path& from, const std::filesystem::path& to, bool overwrite) = 0; virtual Result remove(const std::filesystem::path& p) = 0; virtual Result> listDirectory( const std::filesystem::path& p) = 0; }; } // namespace ccm