Fix build with Boost 1.77.0

BOOST_FILESYSTEM_C_STR changed to accept the path as an argument
This commit is contained in:
Rafael Sadowski 2021-08-16 06:34:02 +02:00
parent 3facf0a8ae
commit acb7aad27e
3 changed files with 12 additions and 0 deletions

View file

@ -242,7 +242,11 @@ void ofstream::close()
} }
#else // __GLIBCXX__ #else // __GLIBCXX__
#if BOOST_VERSION >= 107700
static_assert(sizeof(*BOOST_FILESYSTEM_C_STR(fs::path())) == sizeof(wchar_t),
#else
static_assert(sizeof(*fs::path().BOOST_FILESYSTEM_C_STR) == sizeof(wchar_t), static_assert(sizeof(*fs::path().BOOST_FILESYSTEM_C_STR) == sizeof(wchar_t),
#endif // BOOST_VERSION >= 107700
"Warning: This build is using boost::filesystem ofstream and ifstream " "Warning: This build is using boost::filesystem ofstream and ifstream "
"implementations which will fail to open paths containing multibyte " "implementations which will fail to open paths containing multibyte "
"characters. You should delete this static_assert to ignore this warning, " "characters. You should delete this static_assert to ignore this warning, "

View file

@ -25,7 +25,11 @@ BOOST_AUTO_TEST_CASE(getwalletenv_file)
std::string test_name = "test_name.dat"; std::string test_name = "test_name.dat";
const fs::path datadir = gArgs.GetDataDirNet(); const fs::path datadir = gArgs.GetDataDirNet();
fs::path file_path = datadir / test_name; fs::path file_path = datadir / test_name;
#if BOOST_VERSION >= 107700
std::ofstream f(BOOST_FILESYSTEM_C_STR(file_path));
#else
std::ofstream f(file_path.BOOST_FILESYSTEM_C_STR); std::ofstream f(file_path.BOOST_FILESYSTEM_C_STR);
#endif // BOOST_VERSION >= 107700
f.close(); f.close();
std::string filename; std::string filename;

View file

@ -32,7 +32,11 @@ InitWalletDirTestingSetup::InitWalletDirTestingSetup(const std::string& chainNam
fs::create_directories(m_walletdir_path_cases["default"]); fs::create_directories(m_walletdir_path_cases["default"]);
fs::create_directories(m_walletdir_path_cases["custom"]); fs::create_directories(m_walletdir_path_cases["custom"]);
fs::create_directories(m_walletdir_path_cases["relative"]); fs::create_directories(m_walletdir_path_cases["relative"]);
#if BOOST_VERSION >= 107700
std::ofstream f(BOOST_FILESYSTEM_C_STR(m_walletdir_path_cases["file"]));
#else
std::ofstream f(m_walletdir_path_cases["file"].BOOST_FILESYSTEM_C_STR); std::ofstream f(m_walletdir_path_cases["file"].BOOST_FILESYSTEM_C_STR);
#endif // BOOST_VERSION >= 107700
f.close(); f.close();
} }