fs: for boost 1.74 and up, use c++17 compatible copy_options

In boost 1.74.0, boost::filesystem adapted path::copy_option enum
to be the same as the enum in the fs::path from c++17, which is
now called copy_options, and its member "overwrite_if_exists"
is now called "overwrite_existing". In boost 1.85, the deprecated
copy_option enum is fully removed.

Because Dogecoin Core currently supports boost 1.60 and up,
conditionally implement the new enum based on the boost version
that is built against.
This commit is contained in:
Patrick Lodder 2024-06-12 05:39:24 -04:00
parent 37909dd1b9
commit 95554c3e5c
No known key found for this signature in database
GPG Key ID: 7C523F5FBABE80E7

View File

@ -4021,7 +4021,11 @@ bool CWallet::BackupWallet(const std::string& strDest)
return false;
}
#if BOOST_VERSION >= 104000
#if BOOST_VERSION >= 107400
// Boost 1.74.0 and up implements std++17 like "copy_options", and this
// is the only remaining enum after 1.85.0
fs::copy_file(pathSrc, pathDest, fs::copy_options::overwrite_existing);
#elif BOOST_VERSION >= 104000
fs::copy_file(pathSrc, pathDest, fs::copy_option::overwrite_if_exists);
#else
fs::copy_file(pathSrc, pathDest);