1#include <xrpl/basics/FileUtilities.h>
3#include <boost/filesystem/operations.hpp>
4#include <boost/filesystem/path.hpp>
5#include <boost/system/detail/errc.hpp>
6#include <boost/system/detail/error_code.hpp>
7#include <boost/system/errc.hpp>
21 boost::system::error_code& ec,
22 boost::filesystem::path
const& sourcePath,
25 using namespace boost::filesystem;
26 using namespace boost::system::errc;
28 path const fullPath{canonical(sourcePath, ec)};
32 if (maxSize && (file_size(fullPath, ec) > *maxSize || ec))
61 boost::system::error_code& ec,
62 boost::filesystem::path
const& destPath,
65 using namespace boost::filesystem;
66 using namespace boost::system::errc;
68 std::ofstream fileStream(destPath.string(), std::ios::out | std::ios::trunc);
76 fileStream << contents;
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::error_code make_error_code(xrpl::TokenCodecErrc e)
std::string getFileContents(boost::system::error_code &ec, boost::filesystem::path const &sourcePath, std::optional< std::size_t > maxSize=std::nullopt)
void writeFileContents(boost::system::error_code &ec, boost::filesystem::path const &destPath, std::string const &contents)