20 #include <ripple/basics/FileUtilities.h>
26 boost::system::error_code& ec,
27 boost::filesystem::path
const& sourcePath,
30 using namespace boost::filesystem;
31 using namespace boost::system::errc;
33 path fullPath{canonical(sourcePath, ec)};
37 if (maxSize && (file_size(fullPath, ec) > *maxSize || ec))
40 ec = make_error_code(file_too_large);
44 ifstream fileStream(fullPath, std::ios::in);
48 ec = make_error_code(
static_cast<errc_t
>(errno));
58 ec = make_error_code(
static_cast<errc_t
>(errno));
67 boost::system::error_code& ec,
68 boost::filesystem::path
const& destPath,
71 using namespace boost::filesystem;
72 using namespace boost::system::errc;
74 ofstream fileStream(destPath, std::ios::out | std::ios::trunc);
78 ec = make_error_code(
static_cast<errc_t
>(errno));
82 fileStream << contents;
86 ec = make_error_code(
static_cast<errc_t
>(errno));