14 std::filesystem::path
const& sourcePath,
15 std::optional<std::size_t> maxSize = std::nullopt);
20 std::filesystem::path
const& destPath,
21 std::string
const& contents);
33 std::filesystem::path
const& base,
34 std::string
const& prefix =
"",
35 std::size_t maxAttempts = 100);
51 operator=(
TempDir const&) =
delete;
std::filesystem::path path_
TempDir()
Construct a temporary directory.
std::string path() const
Get the native path for the temporary directory.
~TempDir()
Destroy a temporary directory.
std::string file(std::string const &name) const
Get the native path for a file.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::filesystem::path uniqueRandomPath(std::filesystem::path const &base, std::string const &prefix="", std::size_t maxAttempts=100)
Generate a unique, non-existing path under base whose filename starts with prefix and ends with a ran...
std::string getFileContents(std::error_code &ec, std::filesystem::path const &sourcePath, std::optional< std::size_t > maxSize=std::nullopt)
void writeFileContents(std::error_code &ec, std::filesystem::path const &destPath, std::string const &contents)