common: support boost filesystem copy_options.

Co-authored-by: selsta <selsta@sent.at>
This commit is contained in:
0xFFFC0000
2024-05-01 02:51:08 +03:30
co-authored by selsta
parent 81d4db08eb
commit 755dddd2bc
6 changed files with 33 additions and 10 deletions
+18
View File
@@ -115,6 +115,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() {}