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.

Cherry-picked from: 95554c3e
Github Pull Request: #3558

Conflicts resolved:
  - boost fs prefix added in src/wallet/wallet.cpp
This commit is contained in:
Patrick Lodder 2024-06-12 05:39:24 -04:00
parent b9a99f613f
commit aa568d45d3
No known key found for this signature in database
GPG Key ID: 7C523F5FBABE80E7

View File

@ -4020,7 +4020,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
boost::filesystem::copy_file(pathSrc, pathDest, boost::filesystem::copy_options::overwrite_existing);
#elif BOOST_VERSION >= 104000
boost::filesystem::copy_file(pathSrc, pathDest, boost::filesystem::copy_option::overwrite_if_exists);
#else
boost::filesystem::copy_file(pathSrc, pathDest);