From 755dddd2bc9a74fe7f2a61fc49af2a98ca4e82ee Mon Sep 17 00:00:00 2001 From: 0xFFFC0000 <0xFFFC0000@proton.me> Date: Tue, 30 Apr 2024 23:20:10 +0000 Subject: common: support boost filesystem copy_options. Co-authored-by: selsta --- src/common/util.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/common/util.cpp') diff --git a/src/common/util.cpp b/src/common/util.cpp index 4b5e2adb8..d5f35ea7a 100644 --- a/src/common/util.cpp +++ b/src/common/util.cpp @@ -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 signal_handler::m_handler; private_file::private_file() noexcept : m_handle(), m_filename() {} -- cgit v1.2.3