Merge #15468: wallet: Use fsbridge::ifstream to fix Windows path issue

6ad79cbd56 wallet: Use fsbridge::ifstream to fix Windows path issue (Chun Kuan Lee)

Pull request description:

  Fix #15460

Tree-SHA512: 1dab04184608543d49c86cbcfb679d63d35cb7bf3bde2e2d9ddf25ec8977de42b7131db5e81a305f3452858079dbcf68f6ad4624c89575d3d7e5b550687fc6ad
This commit is contained in:
Wladimir J. van der Laan 2019-02-27 12:04:26 +01:00
commit a4f9c024c6
No known key found for this signature in database
GPG key ID: 1E4AED62986CD25D
2 changed files with 3 additions and 1 deletions

View file

@ -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;

View file

@ -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