Skip to content

Commit

Permalink
Fix build on Boost 1.81 (espressomd#4655)
Browse files Browse the repository at this point in the history
Description of changes:
- Replace file copy option that was deprecated in Boost 1.81
  • Loading branch information
kodiakhq[bot] authored and jngrad committed Mar 2, 2023
1 parent d54012e commit 4f97192
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/core/io/writer/h5md_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@

#include <utils/Vector.hpp>

#include <boost/filesystem.hpp>
#include <boost/mpi/collectives.hpp>
#include <boost/version.hpp>

#include <mpi.h>

Expand All @@ -56,10 +58,14 @@ static void backup_file(const std::string &from, const std::string &to) {
* have gone wrong.
*/
boost::filesystem::path pfrom(from), pto(to);
#if BOOST_VERSION / 100000 == 1 && BOOST_VERSION / 100 % 1000 >= 74
auto constexpr option_fail_if_exists = boost::filesystem::copy_options::none;
#else
auto constexpr option_fail_if_exists = boost::filesystem::copy_option::none;
#endif
try {
boost::filesystem::copy_file(
pfrom, pto, boost::filesystem::copy_option::fail_if_exists);
} catch (const boost::filesystem::filesystem_error &e) {
boost::filesystem::copy_file(pfrom, pto, option_fail_if_exists);
} catch (const boost::filesystem::filesystem_error &) {
throw left_backupfile();
}
}
Expand Down

0 comments on commit 4f97192

Please sign in to comment.