Skip to content

Commit a4f9c02

Browse files
committed
Merge #15468: wallet: Use fsbridge::ifstream to fix Windows path issue
6ad79cb wallet: Use fsbridge::ifstream to fix Windows path issue (Chun Kuan Lee) Pull request description: Fix #15460 Tree-SHA512: 1dab04184608543d49c86cbcfb679d63d35cb7bf3bde2e2d9ddf25ec8977de42b7131db5e81a305f3452858079dbcf68f6ad4624c89575d3d7e5b550687fc6ad
2 parents 6f43ed4 + 6ad79cb commit a4f9c02

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/fs.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ static std::string openmodeToStr(std::ios_base::openmode mode)
160160
void ifstream::open(const fs::path& p, std::ios_base::openmode mode)
161161
{
162162
close();
163+
mode |= std::ios_base::in;
163164
m_file = fsbridge::fopen(p, openmodeToStr(mode).c_str());
164165
if (m_file == nullptr) {
165166
return;
@@ -183,6 +184,7 @@ void ifstream::close()
183184
void ofstream::open(const fs::path& p, std::ios_base::openmode mode)
184185
{
185186
close();
187+
mode |= std::ios_base::out;
186188
m_file = fsbridge::fopen(p, openmodeToStr(mode).c_str());
187189
if (m_file == nullptr) {
188190
return;

src/wallet/walletutil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static bool IsBerkeleyBtree(const fs::path& path)
3535
boost::system::error_code ec;
3636
if (fs::file_size(path, ec) < 4096) return false;
3737

38-
fs::ifstream file(path.string(), std::ios::binary);
38+
fsbridge::ifstream file(path, std::ios::binary);
3939
if (!file.is_open()) return false;
4040

4141
file.seekg(12, std::ios::beg); // Magic bytes start at offset 12

0 commit comments

Comments
 (0)