aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun Kuan Lee <ken2812221@gmail.com>2019-02-23 22:25:24 +0800
committerChun Kuan Lee <ken2812221@gmail.com>2019-02-23 23:44:28 +0800
commit6ad79cbd562d04ebbcb61c774fb3389e70fedb7c (patch)
treedf3e967adbacd7105162fea735164fc99ee50342
parentf3f9c1de19e6d254e0c3a26ce7a3d8cd57fb7641 (diff)
downloadbitcoin-6ad79cbd562d04ebbcb61c774fb3389e70fedb7c.tar.xz
wallet: Use fsbridge::ifstream to fix Windows path issue
-rw-r--r--src/fs.cpp2
-rw-r--r--src/wallet/walletutil.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/fs.cpp b/src/fs.cpp
index 3c8f4c0247..f937f64e04 100644
--- a/src/fs.cpp
+++ b/src/fs.cpp
@@ -160,6 +160,7 @@ static std::string openmodeToStr(std::ios_base::openmode mode)
void ifstream::open(const fs::path& p, std::ios_base::openmode mode)
{
close();
+ mode |= std::ios_base::in;
m_file = fsbridge::fopen(p, openmodeToStr(mode).c_str());
if (m_file == nullptr) {
return;
@@ -183,6 +184,7 @@ void ifstream::close()
void ofstream::open(const fs::path& p, std::ios_base::openmode mode)
{
close();
+ mode |= std::ios_base::out;
m_file = fsbridge::fopen(p, openmodeToStr(mode).c_str());
if (m_file == nullptr) {
return;
diff --git a/src/wallet/walletutil.cpp b/src/wallet/walletutil.cpp
index 6db4c63acb..d779251d56 100644
--- a/src/wallet/walletutil.cpp
+++ b/src/wallet/walletutil.cpp
@@ -35,7 +35,7 @@ static bool IsBerkeleyBtree(const fs::path& path)
boost::system::error_code ec;
if (fs::file_size(path, ec) < 4096) return false;
- fs::ifstream file(path.string(), std::ios::binary);
+ fsbridge::ifstream file(path, std::ios::binary);
if (!file.is_open()) return false;
file.seekg(12, std::ios::beg); // Magic bytes start at offset 12