Skip to content

Commit 6ad79cb

Browse files
committed
wallet: Use fsbridge::ifstream to fix Windows path issue
1 parent f3f9c1d commit 6ad79cb

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)