From 99a9cc8988dfea35ff6caee2ab2846a47169e8c4 Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Sat, 27 Nov 2021 14:10:48 +0300 Subject: [PATCH] Hack to deal with namespace conflict. It is better to use std:: though. --- src/db.cpp | 8 ++++---- src/init.cpp | 8 ++++---- src/main.cpp | 4 ++-- src/txdb-leveldb.cpp | 12 ++++++------ src/walletdb.cpp | 12 ++++++------ 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/db.cpp b/src/db.cpp index e12e11e..0b1ecb1 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -63,11 +63,11 @@ bool CDBEnv::Open(boost::filesystem::path pathEnv_) return false; pathEnv = pathEnv_; - filesystem::path pathDataDir = pathEnv; + boost::filesystem::path pathDataDir = pathEnv; strPath = pathDataDir.string(); - filesystem::path pathLogDir = pathDataDir / "database"; - filesystem::create_directory(pathLogDir); - filesystem::path pathErrorFile = pathDataDir / "db.log"; + boost::filesystem::path pathLogDir = pathDataDir / "database"; + boost::filesystem::create_directory(pathLogDir); + boost::filesystem::path pathErrorFile = pathDataDir / "db.log"; printf("dbenv.open LogDir=%s ErrorFile=%s\n", pathLogDir.string().c_str(), pathErrorFile.string().c_str()); unsigned int nEnvFlags = 0; diff --git a/src/init.cpp b/src/init.cpp index 0a70532..665c14e 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -587,7 +587,7 @@ bool AppInit2() return false; } - if (filesystem::exists(GetDataDir() / strWalletFileName)) + if (boost::filesystem::exists(GetDataDir() / strWalletFileName)) { CDBEnv::VerifyResult r = bitdb.Verify(strWalletFileName, CWalletDB::Recover); if (r == CDBEnv::RECOVER_OK) @@ -950,13 +950,13 @@ bool AppInit2() StartShutdown(); } - filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat"; - if (filesystem::exists(pathBootstrap)) { + boost::filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat"; + if (boost::filesystem::exists(pathBootstrap)) { uiInterface.InitMessage(_("Importing bootstrap blockchain data file.")); FILE *file = fopen(pathBootstrap.string().c_str(), "rb"); if (file) { - filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old"; + boost::filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old"; LoadExternalBlockFile(file); RenameOver(pathBootstrap, pathBootstrapOld); } diff --git a/src/main.cpp b/src/main.cpp index 613de6b..88fd4dd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2662,7 +2662,7 @@ bool CBlock::CheckBlockSignature() const bool CheckDiskSpace(uint64_t nAdditionalBytes) { - uint64_t nFreeBytesAvailable = filesystem::space(GetDataDir()).available; + uint64_t nFreeBytesAvailable = boost::filesystem::space(GetDataDir()).available; // Check for nMinDiskSpace bytes (currently 50MB) if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes) @@ -2678,7 +2678,7 @@ bool CheckDiskSpace(uint64_t nAdditionalBytes) return true; } -static filesystem::path BlockFilePath(unsigned int nFile) +static boost::filesystem::path BlockFilePath(unsigned int nFile) { string strBlockFn = strprintf("blk%04u.dat", nFile); return GetDataDir() / strBlockFn; diff --git a/src/txdb-leveldb.cpp b/src/txdb-leveldb.cpp index 8f956fe..1cf3c68 100644 --- a/src/txdb-leveldb.cpp +++ b/src/txdb-leveldb.cpp @@ -35,27 +35,27 @@ static leveldb::Options GetOptions() { void init_blockindex(leveldb::Options& options, bool fRemoveOld = false) { // First time init. - filesystem::path directory = GetDataDir() / "txleveldb"; + boost::filesystem::path directory = GetDataDir() / "txleveldb"; if (fRemoveOld) { - filesystem::remove_all(directory); // remove directory + boost::filesystem::remove_all(directory); // remove directory unsigned int nFile = 1; for ( ; ; ) { - filesystem::path strBlockFile = GetDataDir() / strprintf("blk%04u.dat", nFile); + boost::filesystem::path strBlockFile = GetDataDir() / strprintf("blk%04u.dat", nFile); // Break if no such file - if( !filesystem::exists( strBlockFile ) ) + if( !boost::filesystem::exists( strBlockFile ) ) break; - filesystem::remove(strBlockFile); + boost::filesystem::remove(strBlockFile); nFile++; } } - filesystem::create_directory(directory); + boost::filesystem::create_directory(directory); printf("Opening LevelDB in %s\n", directory.string().c_str()); leveldb::Status status = leveldb::DB::Open(options, directory.string(), &txdb); if (!status.ok()) { diff --git a/src/walletdb.cpp b/src/walletdb.cpp index 0f39cdf..5590d86 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -758,20 +758,20 @@ bool BackupWallet(const CWallet& wallet, const string& strDest) bitdb.mapFileUseCount.erase(wallet.strWalletFile); // Copy wallet.dat - filesystem::path pathSrc = GetDataDir() / wallet.strWalletFile; - filesystem::path pathDest(strDest); - if (filesystem::is_directory(pathDest)) + boost::filesystem::path pathSrc = GetDataDir() / wallet.strWalletFile; + boost::filesystem::path pathDest(strDest); + if (boost::filesystem::is_directory(pathDest)) pathDest /= wallet.strWalletFile; try { #if BOOST_VERSION >= 104000 - filesystem::copy_file(pathSrc, pathDest, filesystem::copy_option::overwrite_if_exists); + boost::filesystem::copy_file(pathSrc, pathDest, boost::filesystem::copy_option::overwrite_if_exists); #else - filesystem::copy_file(pathSrc, pathDest); + boost::filesystem::copy_file(pathSrc, pathDest); #endif printf("copied wallet.dat to %s\n", pathDest.string().c_str()); return true; - } catch(const filesystem::filesystem_error &e) { + } catch(const boost::filesystem::filesystem_error &e) { printf("error copying wallet.dat to %s - %s\n", pathDest.string().c_str(), e.what()); return false; } -- 1.7.1