common: support boost filesystem copy_options.

Co-authored-by: selsta <selsta@sent.at>
This commit is contained in:
0xFFFC0000
2024-04-30 23:20:10 +00:00
parent c8214782fb
commit de9c461a98
6 changed files with 33 additions and 10 deletions

View File

@@ -114,6 +114,24 @@ static int flock_exnb(int fd)
namespace tools
{
void copy_file(const std::string& from, const std::string& to)
{
using boost::filesystem::path;
#if BOOST_VERSION < 107400
// Remove this preprocessor if/else when we are bumping the boost version.
boost::filesystem::copy_file(
path(from),
path(to),
boost::filesystem::copy_option::overwrite_if_exists);
#else
boost::filesystem::copy_file(
path(from),
path(to),
boost::filesystem::copy_options::overwrite_existing);
#endif
}
std::function<void(int)> signal_handler::m_handler;
private_file::private_file() noexcept : m_handle(), m_filename() {}