21 return std::string((std::istreambuf_iterator<char>(
file)), std::istreambuf_iterator<char>());
30 std::ofstream
file(
resolved, std::ios::binary | std::ios::trunc);
36 file.write(
text.data(),
static_cast<std::streamsize
>(
text.size()));
std::filesystem::path ResolvePath(std::string_view relativePath)
a relative path against the base directory. If the path is already absolute, returns it as-is.
static std::string ReadFile(const std::filesystem::path &path)
Result< std::string > ReadAllText(std::string_view path)
Read path (resolved via ResolvePath) into a string.
std::expected< void, Error > Status
Status WriteAllText(std::string_view path, std::string_view text)
Write text to path (resolved via ResolvePath), creating its directory.
std::expected< T, Error > Result
static Error Invalid(std::string detail)
static Error NotFound(std::string detail)