Files
Card-Collection-Manager-3/core/include/ccm/ports/IFileSystem.hpp
T
Sebastian Dine 55ace147bc major: initial release
* initial development

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* ci/cd

* ci/cd

* ci/cd

* ci/cd

* ci/cd

* ci/cd

* ci/cd

* pokemon

* pokemon

* pokemon

* pokemon

* pokemon

* pokemon

* improvements

* improvements

* ci/cd

* ci/cd

* improvements

* improvements

* improvements

* improvements

* improvements

* improvements

* improvements

* improvements

* improvements

---------

Co-authored-by: sdine <sdine@sdine.com>
2026-05-09 11:05:47 +02:00

34 lines
1.2 KiB
C++

#pragma once
// IFileSystem - filesystem operations the services need, expressed as a
// narrow port. Real implementation is `StdFileSystem` (over <filesystem>).
// In-memory implementation can be plugged in for tests.
#include "ccm/util/Result.hpp"
#include <filesystem>
#include <string>
#include <vector>
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<void> ensureDirectory(const std::filesystem::path& p) = 0;
virtual Result<std::string> readText(const std::filesystem::path& p) = 0;
virtual Result<void> writeText(const std::filesystem::path& p, std::string_view contents) = 0;
virtual Result<void> copyFile(const std::filesystem::path& from,
const std::filesystem::path& to,
bool overwrite) = 0;
virtual Result<void> remove(const std::filesystem::path& p) = 0;
virtual Result<std::vector<std::filesystem::path>> listDirectory(
const std::filesystem::path& p) = 0;
};
} // namespace ccm