Skip to content

Commit acb7aad

Browse files
committed
Fix build with Boost 1.77.0
BOOST_FILESYSTEM_C_STR changed to accept the path as an argument
1 parent 3facf0a commit acb7aad

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/fs.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,11 @@ void ofstream::close()
242242
}
243243
#else // __GLIBCXX__
244244

245+
#if BOOST_VERSION >= 107700
246+
static_assert(sizeof(*BOOST_FILESYSTEM_C_STR(fs::path())) == sizeof(wchar_t),
247+
#else
245248
static_assert(sizeof(*fs::path().BOOST_FILESYSTEM_C_STR) == sizeof(wchar_t),
249+
#endif // BOOST_VERSION >= 107700
246250
"Warning: This build is using boost::filesystem ofstream and ifstream "
247251
"implementations which will fail to open paths containing multibyte "
248252
"characters. You should delete this static_assert to ignore this warning, "

src/wallet/test/db_tests.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ BOOST_AUTO_TEST_CASE(getwalletenv_file)
2525
std::string test_name = "test_name.dat";
2626
const fs::path datadir = gArgs.GetDataDirNet();
2727
fs::path file_path = datadir / test_name;
28+
#if BOOST_VERSION >= 107700
29+
std::ofstream f(BOOST_FILESYSTEM_C_STR(file_path));
30+
#else
2831
std::ofstream f(file_path.BOOST_FILESYSTEM_C_STR);
32+
#endif // BOOST_VERSION >= 107700
2933
f.close();
3034

3135
std::string filename;

src/wallet/test/init_test_fixture.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ InitWalletDirTestingSetup::InitWalletDirTestingSetup(const std::string& chainNam
3232
fs::create_directories(m_walletdir_path_cases["default"]);
3333
fs::create_directories(m_walletdir_path_cases["custom"]);
3434
fs::create_directories(m_walletdir_path_cases["relative"]);
35+
#if BOOST_VERSION >= 107700
36+
std::ofstream f(BOOST_FILESYSTEM_C_STR(m_walletdir_path_cases["file"]));
37+
#else
3538
std::ofstream f(m_walletdir_path_cases["file"].BOOST_FILESYSTEM_C_STR);
39+
#endif // BOOST_VERSION >= 107700
3640
f.close();
3741
}
3842

0 commit comments

Comments
 (0)