Use fully qualified boost::filesystem identifiers.

This commit is contained in:
Tzigamm 2021-10-12 10:06:52 +02:00
parent 3ef6a62ee7
commit ca7db1d420
5 changed files with 22 additions and 22 deletions

View File

@ -762,14 +762,14 @@ void ThreadRPCServer2(void* parg)
{ {
context.set_options(ssl::context::no_sslv2); context.set_options(ssl::context::no_sslv2);
filesystem::path pathCertFile(GetArg("-rpcsslcertificatechainfile", "server.cert")); boost::filesystem::path pathCertFile(GetArg("-rpcsslcertificatechainfile", "server.cert"));
if (!pathCertFile.is_complete()) pathCertFile = filesystem::path(GetDataDir()) / pathCertFile; if (!pathCertFile.is_complete()) pathCertFile = boost::filesystem::path(GetDataDir()) / pathCertFile;
if (filesystem::exists(pathCertFile)) context.use_certificate_chain_file(pathCertFile.string()); if (boost::filesystem::exists(pathCertFile)) context.use_certificate_chain_file(pathCertFile.string());
else printf("ThreadRPCServer ERROR: missing server certificate file %s\n", pathCertFile.string().c_str()); else printf("ThreadRPCServer ERROR: missing server certificate file %s\n", pathCertFile.string().c_str());
filesystem::path pathPKFile(GetArg("-rpcsslprivatekeyfile", "server.pem")); boost::filesystem::path pathPKFile(GetArg("-rpcsslprivatekeyfile", "server.pem"));
if (!pathPKFile.is_complete()) pathPKFile = filesystem::path(GetDataDir()) / pathPKFile; if (!pathPKFile.is_complete()) pathPKFile = boost::filesystem::path(GetDataDir()) / pathPKFile;
if (filesystem::exists(pathPKFile)) context.use_private_key_file(pathPKFile.string(), ssl::context::pem); if (boost::filesystem::exists(pathPKFile)) context.use_private_key_file(pathPKFile.string(), ssl::context::pem);
else printf("ThreadRPCServer ERROR: missing server private key file %s\n", pathPKFile.string().c_str()); else printf("ThreadRPCServer ERROR: missing server private key file %s\n", pathPKFile.string().c_str());
string strCiphers = GetArg("-rpcsslciphers", "TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH"); string strCiphers = GetArg("-rpcsslciphers", "TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH");

View File

@ -69,11 +69,11 @@ bool CDBEnv::Open(boost::filesystem::path pathEnv_)
return false; return false;
pathEnv = pathEnv_; pathEnv = pathEnv_;
filesystem::path pathDataDir = pathEnv; boost::filesystem::path pathDataDir = pathEnv;
strPath = pathDataDir.string(); strPath = pathDataDir.string();
filesystem::path pathLogDir = pathDataDir / "database"; boost::filesystem::path pathLogDir = pathDataDir / "database";
filesystem::create_directory(pathLogDir); boost::filesystem::create_directory(pathLogDir);
filesystem::path pathErrorFile = pathDataDir / "db.log"; boost::filesystem::path pathErrorFile = pathDataDir / "db.log";
printf("dbenv.open LogDir=%s ErrorFile=%s\n", pathLogDir.string().c_str(), pathErrorFile.string().c_str()); printf("dbenv.open LogDir=%s ErrorFile=%s\n", pathLogDir.string().c_str(), pathErrorFile.string().c_str());
unsigned int nEnvFlags = 0; unsigned int nEnvFlags = 0;

View File

@ -523,7 +523,7 @@ bool AppInit2()
return false; return false;
} }
if (filesystem::exists(GetDataDir() / "wallet.dat")) if (boost::filesystem::exists(GetDataDir() / "wallet.dat"))
{ {
CDBEnv::VerifyResult r = bitdb.Verify("wallet.dat", CWalletDB::Recover); CDBEnv::VerifyResult r = bitdb.Verify("wallet.dat", CWalletDB::Recover);
if (r == CDBEnv::RECOVER_OK) if (r == CDBEnv::RECOVER_OK)
@ -834,13 +834,13 @@ bool AppInit2()
} }
} }
filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat"; boost::filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat";
if (filesystem::exists(pathBootstrap)) { if (boost::filesystem::exists(pathBootstrap)) {
uiInterface.InitMessage(_("<font style='color: black'>Importing bootstrap blockchain data file.</font>")); uiInterface.InitMessage(_("<font style='color: black'>Importing bootstrap blockchain data file.</font>"));
FILE *file = fopen(pathBootstrap.string().c_str(), "rb"); FILE *file = fopen(pathBootstrap.string().c_str(), "rb");
if (file) { if (file) {
filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old"; boost::filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old";
LoadExternalBlockFile(file); LoadExternalBlockFile(file);
RenameOver(pathBootstrap, pathBootstrapOld); RenameOver(pathBootstrap, pathBootstrapOld);
} }

View File

@ -2542,7 +2542,7 @@ bool CBlock::CheckBlockSignature() const
bool CheckDiskSpace(uint64 nAdditionalBytes) bool CheckDiskSpace(uint64 nAdditionalBytes)
{ {
uint64 nFreeBytesAvailable = filesystem::space(GetDataDir()).available; uint64 nFreeBytesAvailable = boost::filesystem::space(GetDataDir()).available;
// Check for nMinDiskSpace bytes (currently 50MB) // Check for nMinDiskSpace bytes (currently 50MB)
if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes) if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes)
@ -2558,7 +2558,7 @@ bool CheckDiskSpace(uint64 nAdditionalBytes)
return true; return true;
} }
static filesystem::path BlockFilePath(unsigned int nFile) static boost::filesystem::path BlockFilePath(unsigned int nFile)
{ {
string strBlockFn = strprintf("blk%04u.dat", nFile); string strBlockFn = strprintf("blk%04u.dat", nFile);
return GetDataDir() / strBlockFn; return GetDataDir() / strBlockFn;

View File

@ -637,20 +637,20 @@ bool BackupWallet(const CWallet& wallet, const string& strDest)
bitdb.mapFileUseCount.erase(wallet.strWalletFile); bitdb.mapFileUseCount.erase(wallet.strWalletFile);
// Copy wallet.dat // Copy wallet.dat
filesystem::path pathSrc = GetDataDir() / wallet.strWalletFile; boost::filesystem::path pathSrc = GetDataDir() / wallet.strWalletFile;
filesystem::path pathDest(strDest); boost::filesystem::path pathDest(strDest);
if (filesystem::is_directory(pathDest)) if (boost::filesystem::is_directory(pathDest))
pathDest /= wallet.strWalletFile; pathDest /= wallet.strWalletFile;
try { try {
#if BOOST_VERSION >= 104000 #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 #else
filesystem::copy_file(pathSrc, pathDest); boost::filesystem::copy_file(pathSrc, pathDest);
#endif #endif
printf("copied wallet.dat to %s\n", pathDest.string().c_str()); printf("copied wallet.dat to %s\n", pathDest.string().c_str());
return true; 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()); printf("error copying wallet.dat to %s - %s\n", pathDest.string().c_str(), e.what());
return false; return false;
} }