SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
FS.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <filesystem>
5#include <span>
6#include <string_view>
7#include <vector>
8
9namespace sourcepp::fs {
10
11[[nodiscard]] std::vector<std::byte> readFileBuffer(const std::filesystem::path& filepath, std::size_t startOffset = 0);
12
13[[nodiscard]] std::string readFileText(const std::filesystem::path& filepath, std::size_t startOffset = 0);
14
15bool writeFileBuffer(const std::filesystem::path& filepath, std::span<const std::byte> buffer);
16
17bool writeFileText(const std::filesystem::path& filepath, std::string_view text);
18
19} // namespace sourcepp::fs
std::string readFileText(const std::filesystem::path &filepath, std::size_t startOffset=0)
Definition FS.cpp:16
bool writeFileText(const std::filesystem::path &filepath, std::string_view text)
Definition FS.cpp:34
bool writeFileBuffer(const std::filesystem::path &filepath, std::span< const std::byte > buffer)
Definition FS.cpp:25
std::vector< std::byte > readFileBuffer(const std::filesystem::path &filepath, std::size_t startOffset=0)
Definition FS.cpp:7