mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-23 07:15:29 +01:00
wallet: Use fsbridge::ifstream to fix Windows path issue
This commit is contained in:
parent
f3f9c1de19
commit
6ad79cbd56
2 changed files with 3 additions and 1 deletions
|
@ -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)
|
void ifstream::open(const fs::path& p, std::ios_base::openmode mode)
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
|
mode |= std::ios_base::in;
|
||||||
m_file = fsbridge::fopen(p, openmodeToStr(mode).c_str());
|
m_file = fsbridge::fopen(p, openmodeToStr(mode).c_str());
|
||||||
if (m_file == nullptr) {
|
if (m_file == nullptr) {
|
||||||
return;
|
return;
|
||||||
|
@ -183,6 +184,7 @@ void ifstream::close()
|
||||||
void ofstream::open(const fs::path& p, std::ios_base::openmode mode)
|
void ofstream::open(const fs::path& p, std::ios_base::openmode mode)
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
|
mode |= std::ios_base::out;
|
||||||
m_file = fsbridge::fopen(p, openmodeToStr(mode).c_str());
|
m_file = fsbridge::fopen(p, openmodeToStr(mode).c_str());
|
||||||
if (m_file == nullptr) {
|
if (m_file == nullptr) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -35,7 +35,7 @@ static bool IsBerkeleyBtree(const fs::path& path)
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
if (fs::file_size(path, ec) < 4096) return false;
|
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;
|
if (!file.is_open()) return false;
|
||||||
|
|
||||||
file.seekg(12, std::ios::beg); // Magic bytes start at offset 12
|
file.seekg(12, std::ios::beg); // Magic bytes start at offset 12
|
||||||
|
|
Loading…
Add table
Reference in a new issue