Replace uses of boost::filesystem with fs
Step two in abstracting away boost::filesystem. To repeat this, simply run: ``` git ls-files \*.cpp \*.h | xargs sed -i 's/boost::filesystem/fs/g' ```
This commit is contained in:
parent
7d5172d354
commit
bac5c9cf64
28 changed files with 139 additions and 139 deletions
|
@ -36,7 +36,7 @@ bool CBanDB::Write(const banmap_t& banSet)
|
||||||
ssBanlist << hash;
|
ssBanlist << hash;
|
||||||
|
|
||||||
// open temp output file, and associate with CAutoFile
|
// open temp output file, and associate with CAutoFile
|
||||||
boost::filesystem::path pathTmp = GetDataDir() / tmpfn;
|
fs::path pathTmp = GetDataDir() / tmpfn;
|
||||||
FILE *file = fopen(pathTmp.string().c_str(), "wb");
|
FILE *file = fopen(pathTmp.string().c_str(), "wb");
|
||||||
CAutoFile fileout(file, SER_DISK, CLIENT_VERSION);
|
CAutoFile fileout(file, SER_DISK, CLIENT_VERSION);
|
||||||
if (fileout.IsNull())
|
if (fileout.IsNull())
|
||||||
|
@ -68,7 +68,7 @@ bool CBanDB::Read(banmap_t& banSet)
|
||||||
return error("%s: Failed to open file %s", __func__, pathBanlist.string());
|
return error("%s: Failed to open file %s", __func__, pathBanlist.string());
|
||||||
|
|
||||||
// use file size to size memory buffer
|
// use file size to size memory buffer
|
||||||
uint64_t fileSize = boost::filesystem::file_size(pathBanlist);
|
uint64_t fileSize = fs::file_size(pathBanlist);
|
||||||
uint64_t dataSize = 0;
|
uint64_t dataSize = 0;
|
||||||
// Don't try to resize to a negative number if file is small
|
// Don't try to resize to a negative number if file is small
|
||||||
if (fileSize >= sizeof(uint256))
|
if (fileSize >= sizeof(uint256))
|
||||||
|
@ -133,7 +133,7 @@ bool CAddrDB::Write(const CAddrMan& addr)
|
||||||
ssPeers << hash;
|
ssPeers << hash;
|
||||||
|
|
||||||
// open temp output file, and associate with CAutoFile
|
// open temp output file, and associate with CAutoFile
|
||||||
boost::filesystem::path pathTmp = GetDataDir() / tmpfn;
|
fs::path pathTmp = GetDataDir() / tmpfn;
|
||||||
FILE *file = fopen(pathTmp.string().c_str(), "wb");
|
FILE *file = fopen(pathTmp.string().c_str(), "wb");
|
||||||
CAutoFile fileout(file, SER_DISK, CLIENT_VERSION);
|
CAutoFile fileout(file, SER_DISK, CLIENT_VERSION);
|
||||||
if (fileout.IsNull())
|
if (fileout.IsNull())
|
||||||
|
@ -165,7 +165,7 @@ bool CAddrDB::Read(CAddrMan& addr)
|
||||||
return error("%s: Failed to open file %s", __func__, pathAddr.string());
|
return error("%s: Failed to open file %s", __func__, pathAddr.string());
|
||||||
|
|
||||||
// use file size to size memory buffer
|
// use file size to size memory buffer
|
||||||
uint64_t fileSize = boost::filesystem::file_size(pathAddr);
|
uint64_t fileSize = fs::file_size(pathAddr);
|
||||||
uint64_t dataSize = 0;
|
uint64_t dataSize = 0;
|
||||||
// Don't try to resize to a negative number if file is small
|
// Don't try to resize to a negative number if file is small
|
||||||
if (fileSize >= sizeof(uint256))
|
if (fileSize >= sizeof(uint256))
|
||||||
|
|
|
@ -80,7 +80,7 @@ typedef std::map<CSubNet, CBanEntry> banmap_t;
|
||||||
class CAddrDB
|
class CAddrDB
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
boost::filesystem::path pathAddr;
|
fs::path pathAddr;
|
||||||
public:
|
public:
|
||||||
CAddrDB();
|
CAddrDB();
|
||||||
bool Write(const CAddrMan& addr);
|
bool Write(const CAddrMan& addr);
|
||||||
|
@ -92,7 +92,7 @@ public:
|
||||||
class CBanDB
|
class CBanDB
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
boost::filesystem::path pathBanlist;
|
fs::path pathBanlist;
|
||||||
public:
|
public:
|
||||||
CBanDB();
|
CBanDB();
|
||||||
bool Write(const banmap_t& banSet);
|
bool Write(const banmap_t& banSet);
|
||||||
|
|
|
@ -96,7 +96,7 @@ static int AppInitRPC(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
if (!boost::filesystem::is_directory(GetDataDir(false))) {
|
if (!fs::is_directory(GetDataDir(false))) {
|
||||||
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", GetArg("-datadir", "").c_str());
|
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", GetArg("-datadir", "").c_str());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ bool AppInit(int argc, char* argv[])
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!boost::filesystem::is_directory(GetDataDir(false)))
|
if (!fs::is_directory(GetDataDir(false)))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", GetArg("-datadir", "").c_str());
|
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", GetArg("-datadir", "").c_str());
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -90,7 +90,7 @@ static leveldb::Options GetOptions(size_t nCacheSize)
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDBWrapper::CDBWrapper(const boost::filesystem::path& path, size_t nCacheSize, bool fMemory, bool fWipe, bool obfuscate)
|
CDBWrapper::CDBWrapper(const fs::path& path, size_t nCacheSize, bool fMemory, bool fWipe, bool obfuscate)
|
||||||
{
|
{
|
||||||
penv = NULL;
|
penv = NULL;
|
||||||
readoptions.verify_checksums = true;
|
readoptions.verify_checksums = true;
|
||||||
|
|
|
@ -194,7 +194,7 @@ public:
|
||||||
* @param[in] obfuscate If true, store data obfuscated via simple XOR. If false, XOR
|
* @param[in] obfuscate If true, store data obfuscated via simple XOR. If false, XOR
|
||||||
* with a zero'd byte array.
|
* with a zero'd byte array.
|
||||||
*/
|
*/
|
||||||
CDBWrapper(const boost::filesystem::path& path, size_t nCacheSize, bool fMemory = false, bool fWipe = false, bool obfuscate = false);
|
CDBWrapper(const fs::path& path, size_t nCacheSize, bool fMemory = false, bool fWipe = false, bool obfuscate = false);
|
||||||
~CDBWrapper();
|
~CDBWrapper();
|
||||||
|
|
||||||
template <typename K, typename V>
|
template <typename K, typename V>
|
||||||
|
|
34
src/init.cpp
34
src/init.cpp
|
@ -212,7 +212,7 @@ void Shutdown()
|
||||||
|
|
||||||
if (fFeeEstimatesInitialized)
|
if (fFeeEstimatesInitialized)
|
||||||
{
|
{
|
||||||
boost::filesystem::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME;
|
fs::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME;
|
||||||
CAutoFile est_fileout(fopen(est_path.string().c_str(), "wb"), SER_DISK, CLIENT_VERSION);
|
CAutoFile est_fileout(fopen(est_path.string().c_str(), "wb"), SER_DISK, CLIENT_VERSION);
|
||||||
if (!est_fileout.IsNull())
|
if (!est_fileout.IsNull())
|
||||||
mempool.WriteFeeEstimates(est_fileout);
|
mempool.WriteFeeEstimates(est_fileout);
|
||||||
|
@ -250,8 +250,8 @@ void Shutdown()
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
try {
|
try {
|
||||||
boost::filesystem::remove(GetPidFile());
|
fs::remove(GetPidFile());
|
||||||
} catch (const boost::filesystem::filesystem_error& e) {
|
} catch (const fs::filesystem_error& e) {
|
||||||
LogPrintf("%s: Unable to remove pidfile: %s\n", __func__, e.what());
|
LogPrintf("%s: Unable to remove pidfile: %s\n", __func__, e.what());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -578,14 +578,14 @@ struct CImportingNow
|
||||||
// works correctly.
|
// works correctly.
|
||||||
void CleanupBlockRevFiles()
|
void CleanupBlockRevFiles()
|
||||||
{
|
{
|
||||||
std::map<std::string, boost::filesystem::path> mapBlockFiles;
|
std::map<std::string, fs::path> mapBlockFiles;
|
||||||
|
|
||||||
// Glob all blk?????.dat and rev?????.dat files from the blocks directory.
|
// Glob all blk?????.dat and rev?????.dat files from the blocks directory.
|
||||||
// Remove the rev files immediately and insert the blk file paths into an
|
// Remove the rev files immediately and insert the blk file paths into an
|
||||||
// ordered map keyed by block file index.
|
// ordered map keyed by block file index.
|
||||||
LogPrintf("Removing unusable blk?????.dat and rev?????.dat files for -reindex with -prune\n");
|
LogPrintf("Removing unusable blk?????.dat and rev?????.dat files for -reindex with -prune\n");
|
||||||
boost::filesystem::path blocksdir = GetDataDir() / "blocks";
|
fs::path blocksdir = GetDataDir() / "blocks";
|
||||||
for (boost::filesystem::directory_iterator it(blocksdir); it != boost::filesystem::directory_iterator(); it++) {
|
for (fs::directory_iterator it(blocksdir); it != fs::directory_iterator(); it++) {
|
||||||
if (is_regular_file(*it) &&
|
if (is_regular_file(*it) &&
|
||||||
it->path().filename().string().length() == 12 &&
|
it->path().filename().string().length() == 12 &&
|
||||||
it->path().filename().string().substr(8,4) == ".dat")
|
it->path().filename().string().substr(8,4) == ".dat")
|
||||||
|
@ -602,7 +602,7 @@ void CleanupBlockRevFiles()
|
||||||
// keeping a separate counter. Once we hit a gap (or if 0 doesn't exist)
|
// keeping a separate counter. Once we hit a gap (or if 0 doesn't exist)
|
||||||
// start removing block files.
|
// start removing block files.
|
||||||
int nContigCounter = 0;
|
int nContigCounter = 0;
|
||||||
BOOST_FOREACH(const PAIRTYPE(std::string, boost::filesystem::path)& item, mapBlockFiles) {
|
BOOST_FOREACH(const PAIRTYPE(std::string, fs::path)& item, mapBlockFiles) {
|
||||||
if (atoi(item.first) == nContigCounter) {
|
if (atoi(item.first) == nContigCounter) {
|
||||||
nContigCounter++;
|
nContigCounter++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -611,7 +611,7 @@ void CleanupBlockRevFiles()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
|
void ThreadImport(std::vector<fs::path> vImportFiles)
|
||||||
{
|
{
|
||||||
const CChainParams& chainparams = Params();
|
const CChainParams& chainparams = Params();
|
||||||
RenameThread("bitcoin-loadblk");
|
RenameThread("bitcoin-loadblk");
|
||||||
|
@ -624,7 +624,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
|
||||||
int nFile = 0;
|
int nFile = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
CDiskBlockPos pos(nFile, 0);
|
CDiskBlockPos pos(nFile, 0);
|
||||||
if (!boost::filesystem::exists(GetBlockPosFilename(pos, "blk")))
|
if (!fs::exists(GetBlockPosFilename(pos, "blk")))
|
||||||
break; // No block files left to reindex
|
break; // No block files left to reindex
|
||||||
FILE *file = OpenBlockFile(pos, true);
|
FILE *file = OpenBlockFile(pos, true);
|
||||||
if (!file)
|
if (!file)
|
||||||
|
@ -641,11 +641,11 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
|
||||||
}
|
}
|
||||||
|
|
||||||
// hardcoded $DATADIR/bootstrap.dat
|
// hardcoded $DATADIR/bootstrap.dat
|
||||||
boost::filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat";
|
fs::path pathBootstrap = GetDataDir() / "bootstrap.dat";
|
||||||
if (boost::filesystem::exists(pathBootstrap)) {
|
if (fs::exists(pathBootstrap)) {
|
||||||
FILE *file = fopen(pathBootstrap.string().c_str(), "rb");
|
FILE *file = fopen(pathBootstrap.string().c_str(), "rb");
|
||||||
if (file) {
|
if (file) {
|
||||||
boost::filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old";
|
fs::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old";
|
||||||
LogPrintf("Importing bootstrap.dat...\n");
|
LogPrintf("Importing bootstrap.dat...\n");
|
||||||
LoadExternalBlockFile(chainparams, file);
|
LoadExternalBlockFile(chainparams, file);
|
||||||
RenameOver(pathBootstrap, pathBootstrapOld);
|
RenameOver(pathBootstrap, pathBootstrapOld);
|
||||||
|
@ -655,7 +655,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
|
||||||
}
|
}
|
||||||
|
|
||||||
// -loadblock=
|
// -loadblock=
|
||||||
BOOST_FOREACH(const boost::filesystem::path& path, vImportFiles) {
|
BOOST_FOREACH(const fs::path& path, vImportFiles) {
|
||||||
FILE *file = fopen(path.string().c_str(), "rb");
|
FILE *file = fopen(path.string().c_str(), "rb");
|
||||||
if (file) {
|
if (file) {
|
||||||
LogPrintf("Importing blocks file %s...\n", path.string());
|
LogPrintf("Importing blocks file %s...\n", path.string());
|
||||||
|
@ -1123,7 +1123,7 @@ static bool LockDataDirectory(bool probeOnly)
|
||||||
std::string strDataDir = GetDataDir().string();
|
std::string strDataDir = GetDataDir().string();
|
||||||
|
|
||||||
// Make sure only a single Bitcoin process is using the data directory.
|
// Make sure only a single Bitcoin process is using the data directory.
|
||||||
boost::filesystem::path pathLockFile = GetDataDir() / ".lock";
|
fs::path pathLockFile = GetDataDir() / ".lock";
|
||||||
FILE* file = fopen(pathLockFile.string().c_str(), "a"); // empty lock file; created if it doesn't exist.
|
FILE* file = fopen(pathLockFile.string().c_str(), "a"); // empty lock file; created if it doesn't exist.
|
||||||
if (file) fclose(file);
|
if (file) fclose(file);
|
||||||
|
|
||||||
|
@ -1388,7 +1388,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||||
fReindex = GetBoolArg("-reindex", false);
|
fReindex = GetBoolArg("-reindex", false);
|
||||||
bool fReindexChainState = GetBoolArg("-reindex-chainstate", false);
|
bool fReindexChainState = GetBoolArg("-reindex-chainstate", false);
|
||||||
|
|
||||||
boost::filesystem::create_directories(GetDataDir() / "blocks");
|
fs::create_directories(GetDataDir() / "blocks");
|
||||||
|
|
||||||
// cache size calculations
|
// cache size calculations
|
||||||
int64_t nTotalCache = (GetArg("-dbcache", nDefaultDbCache) << 20);
|
int64_t nTotalCache = (GetArg("-dbcache", nDefaultDbCache) << 20);
|
||||||
|
@ -1534,7 +1534,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||||
}
|
}
|
||||||
LogPrintf(" block index %15dms\n", GetTimeMillis() - nStart);
|
LogPrintf(" block index %15dms\n", GetTimeMillis() - nStart);
|
||||||
|
|
||||||
boost::filesystem::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME;
|
fs::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME;
|
||||||
CAutoFile est_filein(fopen(est_path.string().c_str(), "rb"), SER_DISK, CLIENT_VERSION);
|
CAutoFile est_filein(fopen(est_path.string().c_str(), "rb"), SER_DISK, CLIENT_VERSION);
|
||||||
// Allowed to fail as this file IS missing on first startup.
|
// Allowed to fail as this file IS missing on first startup.
|
||||||
if (!est_filein.IsNull())
|
if (!est_filein.IsNull())
|
||||||
|
@ -1590,7 +1590,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||||
if (IsArgSet("-blocknotify"))
|
if (IsArgSet("-blocknotify"))
|
||||||
uiInterface.NotifyBlockTip.connect(BlockNotifyCallback);
|
uiInterface.NotifyBlockTip.connect(BlockNotifyCallback);
|
||||||
|
|
||||||
std::vector<boost::filesystem::path> vImportFiles;
|
std::vector<fs::path> vImportFiles;
|
||||||
if (mapMultiArgs.count("-loadblock"))
|
if (mapMultiArgs.count("-loadblock"))
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const std::string& strFile, mapMultiArgs.at("-loadblock"))
|
BOOST_FOREACH(const std::string& strFile, mapMultiArgs.at("-loadblock"))
|
||||||
|
|
|
@ -608,7 +608,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
/// 6. Determine availability of data directory and parse bitcoin.conf
|
/// 6. Determine availability of data directory and parse bitcoin.conf
|
||||||
/// - Do not call GetDataDir(true) before this step finishes
|
/// - Do not call GetDataDir(true) before this step finishes
|
||||||
if (!boost::filesystem::is_directory(GetDataDir(false)))
|
if (!fs::is_directory(GetDataDir(false)))
|
||||||
{
|
{
|
||||||
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME),
|
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME),
|
||||||
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(GetArg("-datadir", ""))));
|
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(GetArg("-datadir", ""))));
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static boost::filesystem::detail::utf8_codecvt_facet utf8;
|
static fs::detail::utf8_codecvt_facet utf8;
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
extern double NSAppKitVersionNumber;
|
extern double NSAppKitVersionNumber;
|
||||||
|
@ -408,10 +408,10 @@ bool isObscured(QWidget *w)
|
||||||
|
|
||||||
void openDebugLogfile()
|
void openDebugLogfile()
|
||||||
{
|
{
|
||||||
boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
|
fs::path pathDebug = GetDataDir() / "debug.log";
|
||||||
|
|
||||||
/* Open debug.log with the associated application */
|
/* Open debug.log with the associated application */
|
||||||
if (boost::filesystem::exists(pathDebug))
|
if (fs::exists(pathDebug))
|
||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathDebug)));
|
QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathDebug)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,7 +595,7 @@ TableViewLastColumnResizingFixer::TableViewLastColumnResizingFixer(QTableView* t
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
boost::filesystem::path static StartupShortcutPath()
|
fs::path static StartupShortcutPath()
|
||||||
{
|
{
|
||||||
std::string chain = ChainNameFromCommandLine();
|
std::string chain = ChainNameFromCommandLine();
|
||||||
if (chain == CBaseChainParams::MAIN)
|
if (chain == CBaseChainParams::MAIN)
|
||||||
|
@ -608,13 +608,13 @@ boost::filesystem::path static StartupShortcutPath()
|
||||||
bool GetStartOnSystemStartup()
|
bool GetStartOnSystemStartup()
|
||||||
{
|
{
|
||||||
// check for Bitcoin*.lnk
|
// check for Bitcoin*.lnk
|
||||||
return boost::filesystem::exists(StartupShortcutPath());
|
return fs::exists(StartupShortcutPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetStartOnSystemStartup(bool fAutoStart)
|
bool SetStartOnSystemStartup(bool fAutoStart)
|
||||||
{
|
{
|
||||||
// If the shortcut exists already, remove it for updating
|
// If the shortcut exists already, remove it for updating
|
||||||
boost::filesystem::remove(StartupShortcutPath());
|
fs::remove(StartupShortcutPath());
|
||||||
|
|
||||||
if (fAutoStart)
|
if (fAutoStart)
|
||||||
{
|
{
|
||||||
|
@ -684,9 +684,9 @@ bool SetStartOnSystemStartup(bool fAutoStart)
|
||||||
// Follow the Desktop Application Autostart Spec:
|
// Follow the Desktop Application Autostart Spec:
|
||||||
// http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html
|
// http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html
|
||||||
|
|
||||||
boost::filesystem::path static GetAutostartDir()
|
fs::path static GetAutostartDir()
|
||||||
{
|
{
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = fs;
|
||||||
|
|
||||||
char* pszConfigHome = getenv("XDG_CONFIG_HOME");
|
char* pszConfigHome = getenv("XDG_CONFIG_HOME");
|
||||||
if (pszConfigHome) return fs::path(pszConfigHome) / "autostart";
|
if (pszConfigHome) return fs::path(pszConfigHome) / "autostart";
|
||||||
|
@ -695,7 +695,7 @@ boost::filesystem::path static GetAutostartDir()
|
||||||
return fs::path();
|
return fs::path();
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::path static GetAutostartFilePath()
|
fs::path static GetAutostartFilePath()
|
||||||
{
|
{
|
||||||
std::string chain = ChainNameFromCommandLine();
|
std::string chain = ChainNameFromCommandLine();
|
||||||
if (chain == CBaseChainParams::MAIN)
|
if (chain == CBaseChainParams::MAIN)
|
||||||
|
@ -705,7 +705,7 @@ boost::filesystem::path static GetAutostartFilePath()
|
||||||
|
|
||||||
bool GetStartOnSystemStartup()
|
bool GetStartOnSystemStartup()
|
||||||
{
|
{
|
||||||
boost::filesystem::ifstream optionFile(GetAutostartFilePath());
|
fs::ifstream optionFile(GetAutostartFilePath());
|
||||||
if (!optionFile.good())
|
if (!optionFile.good())
|
||||||
return false;
|
return false;
|
||||||
// Scan through file for "Hidden=true":
|
// Scan through file for "Hidden=true":
|
||||||
|
@ -725,7 +725,7 @@ bool GetStartOnSystemStartup()
|
||||||
bool SetStartOnSystemStartup(bool fAutoStart)
|
bool SetStartOnSystemStartup(bool fAutoStart)
|
||||||
{
|
{
|
||||||
if (!fAutoStart)
|
if (!fAutoStart)
|
||||||
boost::filesystem::remove(GetAutostartFilePath());
|
fs::remove(GetAutostartFilePath());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char pszExePath[MAX_PATH+1];
|
char pszExePath[MAX_PATH+1];
|
||||||
|
@ -733,9 +733,9 @@ bool SetStartOnSystemStartup(bool fAutoStart)
|
||||||
if (readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1) == -1)
|
if (readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1) == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
boost::filesystem::create_directories(GetAutostartDir());
|
fs::create_directories(GetAutostartDir());
|
||||||
|
|
||||||
boost::filesystem::ofstream optionFile(GetAutostartFilePath(), std::ios_base::out|std::ios_base::trunc);
|
fs::ofstream optionFile(GetAutostartFilePath(), std::ios_base::out|std::ios_base::trunc);
|
||||||
if (!optionFile.good())
|
if (!optionFile.good())
|
||||||
return false;
|
return false;
|
||||||
std::string chain = ChainNameFromCommandLine();
|
std::string chain = ChainNameFromCommandLine();
|
||||||
|
@ -857,12 +857,12 @@ void setClipboard(const QString& str)
|
||||||
QApplication::clipboard()->setText(str, QClipboard::Selection);
|
QApplication::clipboard()->setText(str, QClipboard::Selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::path qstringToBoostPath(const QString &path)
|
fs::path qstringToBoostPath(const QString &path)
|
||||||
{
|
{
|
||||||
return boost::filesystem::path(path.toStdString(), utf8);
|
return fs::path(path.toStdString(), utf8);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString boostPathToQString(const boost::filesystem::path &path)
|
QString boostPathToQString(const fs::path &path)
|
||||||
{
|
{
|
||||||
return QString::fromStdString(path.string(utf8));
|
return QString::fromStdString(path.string(utf8));
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,10 +182,10 @@ namespace GUIUtil
|
||||||
void restoreWindowGeometry(const QString& strSetting, const QSize &defaultSizeIn, QWidget *parent);
|
void restoreWindowGeometry(const QString& strSetting, const QSize &defaultSizeIn, QWidget *parent);
|
||||||
|
|
||||||
/* Convert QString to OS specific boost path through UTF-8 */
|
/* Convert QString to OS specific boost path through UTF-8 */
|
||||||
boost::filesystem::path qstringToBoostPath(const QString &path);
|
fs::path qstringToBoostPath(const QString &path);
|
||||||
|
|
||||||
/* Convert OS specific boost path to QString through UTF-8 */
|
/* Convert OS specific boost path to QString through UTF-8 */
|
||||||
QString boostPathToQString(const boost::filesystem::path &path);
|
QString boostPathToQString(const fs::path &path);
|
||||||
|
|
||||||
/* Convert seconds into a QString with days, hours, mins, secs */
|
/* Convert seconds into a QString with days, hours, mins, secs */
|
||||||
QString formatDurationStr(int secs);
|
QString formatDurationStr(int secs);
|
||||||
|
|
|
@ -69,7 +69,7 @@ FreespaceChecker::FreespaceChecker(Intro *_intro)
|
||||||
|
|
||||||
void FreespaceChecker::check()
|
void FreespaceChecker::check()
|
||||||
{
|
{
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = fs;
|
||||||
QString dataDirStr = intro->getPathToCheck();
|
QString dataDirStr = intro->getPathToCheck();
|
||||||
fs::path dataDir = GUIUtil::qstringToBoostPath(dataDirStr);
|
fs::path dataDir = GUIUtil::qstringToBoostPath(dataDirStr);
|
||||||
uint64_t freeBytesAvailable = 0;
|
uint64_t freeBytesAvailable = 0;
|
||||||
|
@ -189,7 +189,7 @@ QString Intro::getDefaultDataDirectory()
|
||||||
|
|
||||||
bool Intro::pickDataDirectory()
|
bool Intro::pickDataDirectory()
|
||||||
{
|
{
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = fs;
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
/* If data directory provided on command line, no need to look at settings
|
/* If data directory provided on command line, no need to look at settings
|
||||||
or show a picking dialog */
|
or show a picking dialog */
|
||||||
|
|
|
@ -155,5 +155,5 @@ void RPCNestedTests::rpcNestedTests()
|
||||||
delete pblocktree;
|
delete pblocktree;
|
||||||
pblocktree = nullptr;
|
pblocktree = nullptr;
|
||||||
|
|
||||||
boost::filesystem::remove_all(boost::filesystem::path(path));
|
fs::remove_all(fs::path(path));
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,9 +66,9 @@ static const std::string COOKIEAUTH_USER = "__cookie__";
|
||||||
/** Default name for auth cookie file */
|
/** Default name for auth cookie file */
|
||||||
static const std::string COOKIEAUTH_FILE = ".cookie";
|
static const std::string COOKIEAUTH_FILE = ".cookie";
|
||||||
|
|
||||||
boost::filesystem::path GetAuthCookieFile()
|
fs::path GetAuthCookieFile()
|
||||||
{
|
{
|
||||||
boost::filesystem::path path(GetArg("-rpccookiefile", COOKIEAUTH_FILE));
|
fs::path path(GetArg("-rpccookiefile", COOKIEAUTH_FILE));
|
||||||
if (!path.is_complete()) path = GetDataDir() / path;
|
if (!path.is_complete()) path = GetDataDir() / path;
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ bool GenerateAuthCookie(std::string *cookie_out)
|
||||||
* these are set to 077 in init.cpp unless overridden with -sysperms.
|
* these are set to 077 in init.cpp unless overridden with -sysperms.
|
||||||
*/
|
*/
|
||||||
std::ofstream file;
|
std::ofstream file;
|
||||||
boost::filesystem::path filepath = GetAuthCookieFile();
|
fs::path filepath = GetAuthCookieFile();
|
||||||
file.open(filepath.string().c_str());
|
file.open(filepath.string().c_str());
|
||||||
if (!file.is_open()) {
|
if (!file.is_open()) {
|
||||||
LogPrintf("Unable to open cookie authentication file %s for writing\n", filepath.string());
|
LogPrintf("Unable to open cookie authentication file %s for writing\n", filepath.string());
|
||||||
|
@ -103,7 +103,7 @@ bool GetAuthCookie(std::string *cookie_out)
|
||||||
{
|
{
|
||||||
std::ifstream file;
|
std::ifstream file;
|
||||||
std::string cookie;
|
std::string cookie;
|
||||||
boost::filesystem::path filepath = GetAuthCookieFile();
|
fs::path filepath = GetAuthCookieFile();
|
||||||
file.open(filepath.string().c_str());
|
file.open(filepath.string().c_str());
|
||||||
if (!file.is_open())
|
if (!file.is_open())
|
||||||
return false;
|
return false;
|
||||||
|
@ -118,8 +118,8 @@ bool GetAuthCookie(std::string *cookie_out)
|
||||||
void DeleteAuthCookie()
|
void DeleteAuthCookie()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
boost::filesystem::remove(GetAuthCookieFile());
|
fs::remove(GetAuthCookieFile());
|
||||||
} catch (const boost::filesystem::filesystem_error& e) {
|
} catch (const fs::filesystem_error& e) {
|
||||||
LogPrintf("%s: Unable to remove random auth cookie file: %s\n", __func__, e.what());
|
LogPrintf("%s: Unable to remove random auth cookie file: %s\n", __func__, e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ std::string JSONRPCReply(const UniValue& result, const UniValue& error, const Un
|
||||||
UniValue JSONRPCError(int code, const std::string& message);
|
UniValue JSONRPCError(int code, const std::string& message);
|
||||||
|
|
||||||
/** Get name of RPC authentication cookie file */
|
/** Get name of RPC authentication cookie file */
|
||||||
boost::filesystem::path GetAuthCookieFile();
|
fs::path GetAuthCookieFile();
|
||||||
/** Generate a new RPC authentication cookie and write it to disk */
|
/** Generate a new RPC authentication cookie and write it to disk */
|
||||||
bool GenerateAuthCookie(std::string *cookie_out);
|
bool GenerateAuthCookie(std::string *cookie_out);
|
||||||
/** Read the RPC authentication cookie from disk */
|
/** Read the RPC authentication cookie from disk */
|
||||||
|
|
|
@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper)
|
||||||
// Perform tests both obfuscated and non-obfuscated.
|
// Perform tests both obfuscated and non-obfuscated.
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
bool obfuscate = (bool)i;
|
bool obfuscate = (bool)i;
|
||||||
boost::filesystem::path ph = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
|
fs::path ph = fs::temp_directory_path() / fs::unique_path();
|
||||||
CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate);
|
CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate);
|
||||||
char key = 'k';
|
char key = 'k';
|
||||||
uint256 in = GetRandHash();
|
uint256 in = GetRandHash();
|
||||||
|
@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_batch)
|
||||||
// Perform tests both obfuscated and non-obfuscated.
|
// Perform tests both obfuscated and non-obfuscated.
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
bool obfuscate = (bool)i;
|
bool obfuscate = (bool)i;
|
||||||
boost::filesystem::path ph = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
|
fs::path ph = fs::temp_directory_path() / fs::unique_path();
|
||||||
CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate);
|
CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate);
|
||||||
|
|
||||||
char key = 'i';
|
char key = 'i';
|
||||||
|
@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_iterator)
|
||||||
// Perform tests both obfuscated and non-obfuscated.
|
// Perform tests both obfuscated and non-obfuscated.
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
bool obfuscate = (bool)i;
|
bool obfuscate = (bool)i;
|
||||||
boost::filesystem::path ph = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
|
fs::path ph = fs::temp_directory_path() / fs::unique_path();
|
||||||
CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate);
|
CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate);
|
||||||
|
|
||||||
// The two keys are intentionally chosen for ordering
|
// The two keys are intentionally chosen for ordering
|
||||||
|
@ -125,8 +125,8 @@ BOOST_AUTO_TEST_CASE(dbwrapper_iterator)
|
||||||
// Test that we do not obfuscation if there is existing data.
|
// Test that we do not obfuscation if there is existing data.
|
||||||
BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
|
BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
|
||||||
{
|
{
|
||||||
// We're going to share this boost::filesystem::path between two wrappers
|
// We're going to share this fs::path between two wrappers
|
||||||
boost::filesystem::path ph = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
|
fs::path ph = fs::temp_directory_path() / fs::unique_path();
|
||||||
create_directories(ph);
|
create_directories(ph);
|
||||||
|
|
||||||
// Set up a non-obfuscated wrapper to write some initial data.
|
// Set up a non-obfuscated wrapper to write some initial data.
|
||||||
|
@ -167,8 +167,8 @@ BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
|
||||||
// Ensure that we start obfuscating during a reindex.
|
// Ensure that we start obfuscating during a reindex.
|
||||||
BOOST_AUTO_TEST_CASE(existing_data_reindex)
|
BOOST_AUTO_TEST_CASE(existing_data_reindex)
|
||||||
{
|
{
|
||||||
// We're going to share this boost::filesystem::path between two wrappers
|
// We're going to share this fs::path between two wrappers
|
||||||
boost::filesystem::path ph = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
|
fs::path ph = fs::temp_directory_path() / fs::unique_path();
|
||||||
create_directories(ph);
|
create_directories(ph);
|
||||||
|
|
||||||
// Set up a non-obfuscated wrapper to write some initial data.
|
// Set up a non-obfuscated wrapper to write some initial data.
|
||||||
|
@ -204,7 +204,7 @@ BOOST_AUTO_TEST_CASE(existing_data_reindex)
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(iterator_ordering)
|
BOOST_AUTO_TEST_CASE(iterator_ordering)
|
||||||
{
|
{
|
||||||
boost::filesystem::path ph = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
|
fs::path ph = fs::temp_directory_path() / fs::unique_path();
|
||||||
CDBWrapper dbw(ph, (1 << 20), true, false, false);
|
CDBWrapper dbw(ph, (1 << 20), true, false, false);
|
||||||
for (int x=0x00; x<256; ++x) {
|
for (int x=0x00; x<256; ++x) {
|
||||||
uint8_t key = x;
|
uint8_t key = x;
|
||||||
|
@ -275,7 +275,7 @@ BOOST_AUTO_TEST_CASE(iterator_string_ordering)
|
||||||
{
|
{
|
||||||
char buf[10];
|
char buf[10];
|
||||||
|
|
||||||
boost::filesystem::path ph = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
|
fs::path ph = fs::temp_directory_path() / fs::unique_path();
|
||||||
CDBWrapper dbw(ph, (1 << 20), true, false, false);
|
CDBWrapper dbw(ph, (1 << 20), true, false, false);
|
||||||
for (int x=0x00; x<10; ++x) {
|
for (int x=0x00; x<10; ++x) {
|
||||||
for (int y = 0; y < 10; y++) {
|
for (int y = 0; y < 10; y++) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha
|
||||||
RegisterAllCoreRPCCommands(tableRPC);
|
RegisterAllCoreRPCCommands(tableRPC);
|
||||||
ClearDatadirCache();
|
ClearDatadirCache();
|
||||||
pathTemp = GetTempPath() / strprintf("test_bitcoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
|
pathTemp = GetTempPath() / strprintf("test_bitcoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
|
||||||
boost::filesystem::create_directories(pathTemp);
|
fs::create_directories(pathTemp);
|
||||||
ForceSetArg("-datadir", pathTemp.string());
|
ForceSetArg("-datadir", pathTemp.string());
|
||||||
mempool.setSanityCheck(1.0);
|
mempool.setSanityCheck(1.0);
|
||||||
pblocktree = new CBlockTreeDB(1 << 20, true);
|
pblocktree = new CBlockTreeDB(1 << 20, true);
|
||||||
|
@ -91,7 +91,7 @@ TestingSetup::~TestingSetup()
|
||||||
delete pcoinsTip;
|
delete pcoinsTip;
|
||||||
delete pcoinsdbview;
|
delete pcoinsdbview;
|
||||||
delete pblocktree;
|
delete pblocktree;
|
||||||
boost::filesystem::remove_all(pathTemp);
|
fs::remove_all(pathTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestChain100Setup::TestChain100Setup() : TestingSetup(CBaseChainParams::REGTEST)
|
TestChain100Setup::TestChain100Setup() : TestingSetup(CBaseChainParams::REGTEST)
|
||||||
|
|
|
@ -30,7 +30,7 @@ struct BasicTestingSetup {
|
||||||
class CConnman;
|
class CConnman;
|
||||||
struct TestingSetup: public BasicTestingSetup {
|
struct TestingSetup: public BasicTestingSetup {
|
||||||
CCoinsViewDB *pcoinsdbview;
|
CCoinsViewDB *pcoinsdbview;
|
||||||
boost::filesystem::path pathTemp;
|
fs::path pathTemp;
|
||||||
boost::thread_group threadGroup;
|
boost::thread_group threadGroup;
|
||||||
CConnman* connman;
|
CConnman* connman;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,6 @@
|
||||||
|
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
|
|
||||||
boost::filesystem::path GetTempPath() {
|
fs::path GetTempPath() {
|
||||||
return boost::filesystem::temp_directory_path();
|
return fs::temp_directory_path();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,6 @@
|
||||||
|
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
|
|
||||||
boost::filesystem::path GetTempPath();
|
fs::path GetTempPath();
|
||||||
|
|
||||||
#endif // BITCOIN_TEST_TESTUTIL_H
|
#endif // BITCOIN_TEST_TESTUTIL_H
|
||||||
|
|
56
src/util.cpp
56
src/util.cpp
|
@ -214,7 +214,7 @@ void OpenDebugLog()
|
||||||
|
|
||||||
assert(fileout == NULL);
|
assert(fileout == NULL);
|
||||||
assert(vMsgsBeforeOpenLog);
|
assert(vMsgsBeforeOpenLog);
|
||||||
boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
|
fs::path pathDebug = GetDataDir() / "debug.log";
|
||||||
fileout = fopen(pathDebug.string().c_str(), "a");
|
fileout = fopen(pathDebug.string().c_str(), "a");
|
||||||
if (fileout) {
|
if (fileout) {
|
||||||
setbuf(fileout, NULL); // unbuffered
|
setbuf(fileout, NULL); // unbuffered
|
||||||
|
@ -353,7 +353,7 @@ int LogPrintStr(const std::string &str)
|
||||||
// reopen the log file, if requested
|
// reopen the log file, if requested
|
||||||
if (fReopenDebugLog) {
|
if (fReopenDebugLog) {
|
||||||
fReopenDebugLog = false;
|
fReopenDebugLog = false;
|
||||||
boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
|
fs::path pathDebug = GetDataDir() / "debug.log";
|
||||||
if (freopen(pathDebug.string().c_str(),"a",fileout) != NULL)
|
if (freopen(pathDebug.string().c_str(),"a",fileout) != NULL)
|
||||||
setbuf(fileout, NULL); // unbuffered
|
setbuf(fileout, NULL); // unbuffered
|
||||||
}
|
}
|
||||||
|
@ -511,9 +511,9 @@ void PrintExceptionContinue(const std::exception* pex, const char* pszThread)
|
||||||
fprintf(stderr, "\n\n************************\n%s\n", message.c_str());
|
fprintf(stderr, "\n\n************************\n%s\n", message.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::path GetDefaultDataDir()
|
fs::path GetDefaultDataDir()
|
||||||
{
|
{
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = fs;
|
||||||
// Windows < Vista: C:\Documents and Settings\Username\Application Data\Bitcoin
|
// Windows < Vista: C:\Documents and Settings\Username\Application Data\Bitcoin
|
||||||
// Windows >= Vista: C:\Users\Username\AppData\Roaming\Bitcoin
|
// Windows >= Vista: C:\Users\Username\AppData\Roaming\Bitcoin
|
||||||
// Mac: ~/Library/Application Support/Bitcoin
|
// Mac: ~/Library/Application Support/Bitcoin
|
||||||
|
@ -538,13 +538,13 @@ boost::filesystem::path GetDefaultDataDir()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static boost::filesystem::path pathCached;
|
static fs::path pathCached;
|
||||||
static boost::filesystem::path pathCachedNetSpecific;
|
static fs::path pathCachedNetSpecific;
|
||||||
static CCriticalSection csPathCached;
|
static CCriticalSection csPathCached;
|
||||||
|
|
||||||
const boost::filesystem::path &GetDataDir(bool fNetSpecific)
|
const fs::path &GetDataDir(bool fNetSpecific)
|
||||||
{
|
{
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = fs;
|
||||||
|
|
||||||
LOCK(csPathCached);
|
LOCK(csPathCached);
|
||||||
|
|
||||||
|
@ -576,13 +576,13 @@ void ClearDatadirCache()
|
||||||
{
|
{
|
||||||
LOCK(csPathCached);
|
LOCK(csPathCached);
|
||||||
|
|
||||||
pathCached = boost::filesystem::path();
|
pathCached = fs::path();
|
||||||
pathCachedNetSpecific = boost::filesystem::path();
|
pathCachedNetSpecific = fs::path();
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::path GetConfigFile(const std::string& confPath)
|
fs::path GetConfigFile(const std::string& confPath)
|
||||||
{
|
{
|
||||||
boost::filesystem::path pathConfigFile(confPath);
|
fs::path pathConfigFile(confPath);
|
||||||
if (!pathConfigFile.is_complete())
|
if (!pathConfigFile.is_complete())
|
||||||
pathConfigFile = GetDataDir(false) / pathConfigFile;
|
pathConfigFile = GetDataDir(false) / pathConfigFile;
|
||||||
|
|
||||||
|
@ -591,7 +591,7 @@ boost::filesystem::path GetConfigFile(const std::string& confPath)
|
||||||
|
|
||||||
void ReadConfigFile(const std::string& confPath)
|
void ReadConfigFile(const std::string& confPath)
|
||||||
{
|
{
|
||||||
boost::filesystem::ifstream streamConfig(GetConfigFile(confPath));
|
fs::ifstream streamConfig(GetConfigFile(confPath));
|
||||||
if (!streamConfig.good())
|
if (!streamConfig.good())
|
||||||
return; // No bitcoin.conf file is OK
|
return; // No bitcoin.conf file is OK
|
||||||
|
|
||||||
|
@ -616,14 +616,14 @@ void ReadConfigFile(const std::string& confPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
boost::filesystem::path GetPidFile()
|
fs::path GetPidFile()
|
||||||
{
|
{
|
||||||
boost::filesystem::path pathPidFile(GetArg("-pid", BITCOIN_PID_FILENAME));
|
fs::path pathPidFile(GetArg("-pid", BITCOIN_PID_FILENAME));
|
||||||
if (!pathPidFile.is_complete()) pathPidFile = GetDataDir() / pathPidFile;
|
if (!pathPidFile.is_complete()) pathPidFile = GetDataDir() / pathPidFile;
|
||||||
return pathPidFile;
|
return pathPidFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatePidFile(const boost::filesystem::path &path, pid_t pid)
|
void CreatePidFile(const fs::path &path, pid_t pid)
|
||||||
{
|
{
|
||||||
FILE* file = fopen(path.string().c_str(), "w");
|
FILE* file = fopen(path.string().c_str(), "w");
|
||||||
if (file)
|
if (file)
|
||||||
|
@ -634,7 +634,7 @@ void CreatePidFile(const boost::filesystem::path &path, pid_t pid)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest)
|
bool RenameOver(fs::path src, fs::path dest)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
return MoveFileExA(src.string().c_str(), dest.string().c_str(),
|
return MoveFileExA(src.string().c_str(), dest.string().c_str(),
|
||||||
|
@ -650,13 +650,13 @@ bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest)
|
||||||
* Specifically handles case where path p exists, but it wasn't possible for the user to
|
* Specifically handles case where path p exists, but it wasn't possible for the user to
|
||||||
* write to the parent directory.
|
* write to the parent directory.
|
||||||
*/
|
*/
|
||||||
bool TryCreateDirectory(const boost::filesystem::path& p)
|
bool TryCreateDirectory(const fs::path& p)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return boost::filesystem::create_directory(p);
|
return fs::create_directory(p);
|
||||||
} catch (const boost::filesystem::filesystem_error&) {
|
} catch (const fs::filesystem_error&) {
|
||||||
if (!boost::filesystem::exists(p) || !boost::filesystem::is_directory(p))
|
if (!fs::exists(p) || !fs::is_directory(p))
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -763,11 +763,11 @@ void ShrinkDebugFile()
|
||||||
// Amount of debug.log to save at end when shrinking (must fit in memory)
|
// Amount of debug.log to save at end when shrinking (must fit in memory)
|
||||||
constexpr size_t RECENT_DEBUG_HISTORY_SIZE = 10 * 1000000;
|
constexpr size_t RECENT_DEBUG_HISTORY_SIZE = 10 * 1000000;
|
||||||
// Scroll debug.log if it's getting too big
|
// Scroll debug.log if it's getting too big
|
||||||
boost::filesystem::path pathLog = GetDataDir() / "debug.log";
|
fs::path pathLog = GetDataDir() / "debug.log";
|
||||||
FILE* file = fopen(pathLog.string().c_str(), "r");
|
FILE* file = fopen(pathLog.string().c_str(), "r");
|
||||||
// If debug.log file is more than 10% bigger the RECENT_DEBUG_HISTORY_SIZE
|
// If debug.log file is more than 10% bigger the RECENT_DEBUG_HISTORY_SIZE
|
||||||
// trim it down by saving only the last RECENT_DEBUG_HISTORY_SIZE bytes
|
// trim it down by saving only the last RECENT_DEBUG_HISTORY_SIZE bytes
|
||||||
if (file && boost::filesystem::file_size(pathLog) > 11 * (RECENT_DEBUG_HISTORY_SIZE / 10))
|
if (file && fs::file_size(pathLog) > 11 * (RECENT_DEBUG_HISTORY_SIZE / 10))
|
||||||
{
|
{
|
||||||
// Restart the file with some of the end
|
// Restart the file with some of the end
|
||||||
std::vector<char> vch(RECENT_DEBUG_HISTORY_SIZE, 0);
|
std::vector<char> vch(RECENT_DEBUG_HISTORY_SIZE, 0);
|
||||||
|
@ -787,9 +787,9 @@ void ShrinkDebugFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate)
|
fs::path GetSpecialFolderPath(int nFolder, bool fCreate)
|
||||||
{
|
{
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = fs;
|
||||||
|
|
||||||
char pszPath[MAX_PATH] = "";
|
char pszPath[MAX_PATH] = "";
|
||||||
|
|
||||||
|
@ -850,9 +850,9 @@ void SetupEnvironment()
|
||||||
// The path locale is lazy initialized and to avoid deinitialization errors
|
// The path locale is lazy initialized and to avoid deinitialization errors
|
||||||
// in multithreading environments, it is set explicitly by the main thread.
|
// in multithreading environments, it is set explicitly by the main thread.
|
||||||
// A dummy locale is used to extract the internal default locale, used by
|
// A dummy locale is used to extract the internal default locale, used by
|
||||||
// boost::filesystem::path, which is then used to explicitly imbue the path.
|
// fs::path, which is then used to explicitly imbue the path.
|
||||||
std::locale loc = boost::filesystem::path::imbue(std::locale::classic());
|
std::locale loc = fs::path::imbue(std::locale::classic());
|
||||||
boost::filesystem::path::imbue(loc);
|
fs::path::imbue(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetupNetworking()
|
bool SetupNetworking()
|
||||||
|
|
16
src/util.h
16
src/util.h
|
@ -144,19 +144,19 @@ void FileCommit(FILE *file);
|
||||||
bool TruncateFile(FILE *file, unsigned int length);
|
bool TruncateFile(FILE *file, unsigned int length);
|
||||||
int RaiseFileDescriptorLimit(int nMinFD);
|
int RaiseFileDescriptorLimit(int nMinFD);
|
||||||
void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length);
|
void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length);
|
||||||
bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest);
|
bool RenameOver(fs::path src, fs::path dest);
|
||||||
bool TryCreateDirectory(const boost::filesystem::path& p);
|
bool TryCreateDirectory(const fs::path& p);
|
||||||
boost::filesystem::path GetDefaultDataDir();
|
fs::path GetDefaultDataDir();
|
||||||
const boost::filesystem::path &GetDataDir(bool fNetSpecific = true);
|
const fs::path &GetDataDir(bool fNetSpecific = true);
|
||||||
void ClearDatadirCache();
|
void ClearDatadirCache();
|
||||||
boost::filesystem::path GetConfigFile(const std::string& confPath);
|
fs::path GetConfigFile(const std::string& confPath);
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
boost::filesystem::path GetPidFile();
|
fs::path GetPidFile();
|
||||||
void CreatePidFile(const boost::filesystem::path &path, pid_t pid);
|
void CreatePidFile(const fs::path &path, pid_t pid);
|
||||||
#endif
|
#endif
|
||||||
void ReadConfigFile(const std::string& confPath);
|
void ReadConfigFile(const std::string& confPath);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate = true);
|
fs::path GetSpecialFolderPath(int nFolder, bool fCreate = true);
|
||||||
#endif
|
#endif
|
||||||
void OpenDebugLog();
|
void OpenDebugLog();
|
||||||
void ShrinkDebugFile();
|
void ShrinkDebugFile();
|
||||||
|
|
|
@ -3314,8 +3314,8 @@ void UnlinkPrunedFiles(const std::set<int>& setFilesToPrune)
|
||||||
{
|
{
|
||||||
for (std::set<int>::iterator it = setFilesToPrune.begin(); it != setFilesToPrune.end(); ++it) {
|
for (std::set<int>::iterator it = setFilesToPrune.begin(); it != setFilesToPrune.end(); ++it) {
|
||||||
CDiskBlockPos pos(*it, 0);
|
CDiskBlockPos pos(*it, 0);
|
||||||
boost::filesystem::remove(GetBlockPosFilename(pos, "blk"));
|
fs::remove(GetBlockPosFilename(pos, "blk"));
|
||||||
boost::filesystem::remove(GetBlockPosFilename(pos, "rev"));
|
fs::remove(GetBlockPosFilename(pos, "rev"));
|
||||||
LogPrintf("Prune: %s deleted blk/rev (%05u)\n", __func__, *it);
|
LogPrintf("Prune: %s deleted blk/rev (%05u)\n", __func__, *it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3399,7 +3399,7 @@ void FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPruneAfterHeight
|
||||||
|
|
||||||
bool CheckDiskSpace(uint64_t nAdditionalBytes)
|
bool CheckDiskSpace(uint64_t nAdditionalBytes)
|
||||||
{
|
{
|
||||||
uint64_t nFreeBytesAvailable = boost::filesystem::space(GetDataDir()).available;
|
uint64_t nFreeBytesAvailable = fs::space(GetDataDir()).available;
|
||||||
|
|
||||||
// Check for nMinDiskSpace bytes (currently 50MB)
|
// Check for nMinDiskSpace bytes (currently 50MB)
|
||||||
if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes)
|
if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes)
|
||||||
|
@ -3412,8 +3412,8 @@ FILE* OpenDiskFile(const CDiskBlockPos &pos, const char *prefix, bool fReadOnly)
|
||||||
{
|
{
|
||||||
if (pos.IsNull())
|
if (pos.IsNull())
|
||||||
return NULL;
|
return NULL;
|
||||||
boost::filesystem::path path = GetBlockPosFilename(pos, prefix);
|
fs::path path = GetBlockPosFilename(pos, prefix);
|
||||||
boost::filesystem::create_directories(path.parent_path());
|
fs::create_directories(path.parent_path());
|
||||||
FILE* file = fopen(path.string().c_str(), "rb+");
|
FILE* file = fopen(path.string().c_str(), "rb+");
|
||||||
if (!file && !fReadOnly)
|
if (!file && !fReadOnly)
|
||||||
file = fopen(path.string().c_str(), "wb+");
|
file = fopen(path.string().c_str(), "wb+");
|
||||||
|
@ -3439,7 +3439,7 @@ FILE* OpenUndoFile(const CDiskBlockPos &pos, bool fReadOnly) {
|
||||||
return OpenDiskFile(pos, "rev", fReadOnly);
|
return OpenDiskFile(pos, "rev", fReadOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::path GetBlockPosFilename(const CDiskBlockPos &pos, const char *prefix)
|
fs::path GetBlockPosFilename(const CDiskBlockPos &pos, const char *prefix)
|
||||||
{
|
{
|
||||||
return GetDataDir() / "blocks" / strprintf("%s%05u.dat", prefix, pos.nFile);
|
return GetDataDir() / "blocks" / strprintf("%s%05u.dat", prefix, pos.nFile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,7 +250,7 @@ FILE* OpenBlockFile(const CDiskBlockPos &pos, bool fReadOnly = false);
|
||||||
/** Open an undo file (rev?????.dat) */
|
/** Open an undo file (rev?????.dat) */
|
||||||
FILE* OpenUndoFile(const CDiskBlockPos &pos, bool fReadOnly = false);
|
FILE* OpenUndoFile(const CDiskBlockPos &pos, bool fReadOnly = false);
|
||||||
/** Translation to a filesystem path */
|
/** Translation to a filesystem path */
|
||||||
boost::filesystem::path GetBlockPosFilename(const CDiskBlockPos &pos, const char *prefix);
|
fs::path GetBlockPosFilename(const CDiskBlockPos &pos, const char *prefix);
|
||||||
/** Import blocks from an external file */
|
/** Import blocks from an external file */
|
||||||
bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, CDiskBlockPos *dbp = NULL);
|
bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, CDiskBlockPos *dbp = NULL);
|
||||||
/** Initialize a new block tree database + block data on disk */
|
/** Initialize a new block tree database + block data on disk */
|
||||||
|
|
|
@ -66,7 +66,7 @@ void CDBEnv::Close()
|
||||||
EnvShutdown();
|
EnvShutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDBEnv::Open(const boost::filesystem::path& pathIn)
|
bool CDBEnv::Open(const fs::path& pathIn)
|
||||||
{
|
{
|
||||||
if (fDbEnvInit)
|
if (fDbEnvInit)
|
||||||
return true;
|
return true;
|
||||||
|
@ -74,9 +74,9 @@ bool CDBEnv::Open(const boost::filesystem::path& pathIn)
|
||||||
boost::this_thread::interruption_point();
|
boost::this_thread::interruption_point();
|
||||||
|
|
||||||
strPath = pathIn.string();
|
strPath = pathIn.string();
|
||||||
boost::filesystem::path pathLogDir = pathIn / "database";
|
fs::path pathLogDir = pathIn / "database";
|
||||||
TryCreateDirectory(pathLogDir);
|
TryCreateDirectory(pathLogDir);
|
||||||
boost::filesystem::path pathErrorFile = pathIn / "db.log";
|
fs::path pathErrorFile = pathIn / "db.log";
|
||||||
LogPrintf("CDBEnv::Open: LogDir=%s ErrorFile=%s\n", pathLogDir.string(), pathErrorFile.string());
|
LogPrintf("CDBEnv::Open: LogDir=%s ErrorFile=%s\n", pathLogDir.string(), pathErrorFile.string());
|
||||||
|
|
||||||
unsigned int nEnvFlags = 0;
|
unsigned int nEnvFlags = 0;
|
||||||
|
@ -227,13 +227,13 @@ bool CDB::Recover(const std::string& filename, void *callbackDataIn, bool (*reco
|
||||||
return fSuccess;
|
return fSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDB::VerifyEnvironment(const std::string& walletFile, const boost::filesystem::path& dataDir, std::string& errorStr)
|
bool CDB::VerifyEnvironment(const std::string& walletFile, const fs::path& dataDir, std::string& errorStr)
|
||||||
{
|
{
|
||||||
LogPrintf("Using BerkeleyDB version %s\n", DbEnv::version(0, 0, 0));
|
LogPrintf("Using BerkeleyDB version %s\n", DbEnv::version(0, 0, 0));
|
||||||
LogPrintf("Using wallet %s\n", walletFile);
|
LogPrintf("Using wallet %s\n", walletFile);
|
||||||
|
|
||||||
// Wallet file must be a plain filename without a directory
|
// Wallet file must be a plain filename without a directory
|
||||||
if (walletFile != boost::filesystem::basename(walletFile) + boost::filesystem::extension(walletFile))
|
if (walletFile != fs::basename(walletFile) + fs::extension(walletFile))
|
||||||
{
|
{
|
||||||
errorStr = strprintf(_("Wallet %s resides outside data directory %s"), walletFile, dataDir.string());
|
errorStr = strprintf(_("Wallet %s resides outside data directory %s"), walletFile, dataDir.string());
|
||||||
return false;
|
return false;
|
||||||
|
@ -242,12 +242,12 @@ bool CDB::VerifyEnvironment(const std::string& walletFile, const boost::filesyst
|
||||||
if (!bitdb.Open(dataDir))
|
if (!bitdb.Open(dataDir))
|
||||||
{
|
{
|
||||||
// try moving the database env out of the way
|
// try moving the database env out of the way
|
||||||
boost::filesystem::path pathDatabase = dataDir / "database";
|
fs::path pathDatabase = dataDir / "database";
|
||||||
boost::filesystem::path pathDatabaseBak = dataDir / strprintf("database.%d.bak", GetTime());
|
fs::path pathDatabaseBak = dataDir / strprintf("database.%d.bak", GetTime());
|
||||||
try {
|
try {
|
||||||
boost::filesystem::rename(pathDatabase, pathDatabaseBak);
|
fs::rename(pathDatabase, pathDatabaseBak);
|
||||||
LogPrintf("Moved old %s to %s. Retrying.\n", pathDatabase.string(), pathDatabaseBak.string());
|
LogPrintf("Moved old %s to %s. Retrying.\n", pathDatabase.string(), pathDatabaseBak.string());
|
||||||
} catch (const boost::filesystem::filesystem_error&) {
|
} catch (const fs::filesystem_error&) {
|
||||||
// failure is ok (well, not really, but it's not worse than what we started with)
|
// failure is ok (well, not really, but it's not worse than what we started with)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,9 +261,9 @@ bool CDB::VerifyEnvironment(const std::string& walletFile, const boost::filesyst
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDB::VerifyDatabaseFile(const std::string& walletFile, const boost::filesystem::path& dataDir, std::string& warningStr, std::string& errorStr, bool (*recoverFunc)(const std::string& strFile))
|
bool CDB::VerifyDatabaseFile(const std::string& walletFile, const fs::path& dataDir, std::string& warningStr, std::string& errorStr, bool (*recoverFunc)(const std::string& strFile))
|
||||||
{
|
{
|
||||||
if (boost::filesystem::exists(dataDir / walletFile))
|
if (fs::exists(dataDir / walletFile))
|
||||||
{
|
{
|
||||||
CDBEnv::VerifyResult r = bitdb.Verify(walletFile, recoverFunc);
|
CDBEnv::VerifyResult r = bitdb.Verify(walletFile, recoverFunc);
|
||||||
if (r == CDBEnv::RECOVER_OK)
|
if (r == CDBEnv::RECOVER_OK)
|
||||||
|
@ -590,7 +590,7 @@ void CDBEnv::Flush(bool fShutdown)
|
||||||
dbenv->log_archive(&listp, DB_ARCH_REMOVE);
|
dbenv->log_archive(&listp, DB_ARCH_REMOVE);
|
||||||
Close();
|
Close();
|
||||||
if (!fMockDb)
|
if (!fMockDb)
|
||||||
boost::filesystem::remove_all(boost::filesystem::path(strPath) / "database");
|
fs::remove_all(fs::path(strPath) / "database");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ class CDBEnv
|
||||||
private:
|
private:
|
||||||
bool fDbEnvInit;
|
bool fDbEnvInit;
|
||||||
bool fMockDb;
|
bool fMockDb;
|
||||||
// Don't change into boost::filesystem::path, as that can result in
|
// Don't change into fs::path, as that can result in
|
||||||
// shutdown problems/crashes caused by a static initialized internal pointer.
|
// shutdown problems/crashes caused by a static initialized internal pointer.
|
||||||
std::string strPath;
|
std::string strPath;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public:
|
||||||
typedef std::pair<std::vector<unsigned char>, std::vector<unsigned char> > KeyValPair;
|
typedef std::pair<std::vector<unsigned char>, std::vector<unsigned char> > KeyValPair;
|
||||||
bool Salvage(const std::string& strFile, bool fAggressive, std::vector<KeyValPair>& vResult);
|
bool Salvage(const std::string& strFile, bool fAggressive, std::vector<KeyValPair>& vResult);
|
||||||
|
|
||||||
bool Open(const boost::filesystem::path& path);
|
bool Open(const fs::path& path);
|
||||||
void Close();
|
void Close();
|
||||||
void Flush(bool fShutdown);
|
void Flush(bool fShutdown);
|
||||||
void CheckpointLSN(const std::string& strFile);
|
void CheckpointLSN(const std::string& strFile);
|
||||||
|
@ -109,9 +109,9 @@ public:
|
||||||
ideal to be called periodically */
|
ideal to be called periodically */
|
||||||
static bool PeriodicFlush(std::string strFile);
|
static bool PeriodicFlush(std::string strFile);
|
||||||
/* verifies the database environment */
|
/* verifies the database environment */
|
||||||
static bool VerifyEnvironment(const std::string& walletFile, const boost::filesystem::path& dataDir, std::string& errorStr);
|
static bool VerifyEnvironment(const std::string& walletFile, const fs::path& dataDir, std::string& errorStr);
|
||||||
/* verifies the database file */
|
/* verifies the database file */
|
||||||
static bool VerifyDatabaseFile(const std::string& walletFile, const boost::filesystem::path& dataDir, std::string& warningStr, std::string& errorStr, bool (*recoverFunc)(const std::string& strFile));
|
static bool VerifyDatabaseFile(const std::string& walletFile, const fs::path& dataDir, std::string& warningStr, std::string& errorStr, bool (*recoverFunc)(const std::string& strFile));
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CDB(const CDB&);
|
CDB(const CDB&);
|
||||||
|
|
|
@ -3945,16 +3945,16 @@ bool CWallet::BackupWallet(const std::string& strDest)
|
||||||
bitdb.mapFileUseCount.erase(strWalletFile);
|
bitdb.mapFileUseCount.erase(strWalletFile);
|
||||||
|
|
||||||
// Copy wallet file
|
// Copy wallet file
|
||||||
boost::filesystem::path pathSrc = GetDataDir() / strWalletFile;
|
fs::path pathSrc = GetDataDir() / strWalletFile;
|
||||||
boost::filesystem::path pathDest(strDest);
|
fs::path pathDest(strDest);
|
||||||
if (boost::filesystem::is_directory(pathDest))
|
if (fs::is_directory(pathDest))
|
||||||
pathDest /= strWalletFile;
|
pathDest /= strWalletFile;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boost::filesystem::copy_file(pathSrc, pathDest, boost::filesystem::copy_option::overwrite_if_exists);
|
fs::copy_file(pathSrc, pathDest, fs::copy_option::overwrite_if_exists);
|
||||||
LogPrintf("copied %s to %s\n", strWalletFile, pathDest.string());
|
LogPrintf("copied %s to %s\n", strWalletFile, pathDest.string());
|
||||||
return true;
|
return true;
|
||||||
} catch (const boost::filesystem::filesystem_error& e) {
|
} catch (const fs::filesystem_error& e) {
|
||||||
LogPrintf("error copying %s to %s - %s\n", strWalletFile, pathDest.string(), e.what());
|
LogPrintf("error copying %s to %s - %s\n", strWalletFile, pathDest.string(), e.what());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -842,12 +842,12 @@ bool CWalletDB::RecoverKeysOnlyFilter(void *callbackData, CDataStream ssKey, CDa
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWalletDB::VerifyEnvironment(const std::string& walletFile, const boost::filesystem::path& dataDir, std::string& errorStr)
|
bool CWalletDB::VerifyEnvironment(const std::string& walletFile, const fs::path& dataDir, std::string& errorStr)
|
||||||
{
|
{
|
||||||
return CDB::VerifyEnvironment(walletFile, dataDir, errorStr);
|
return CDB::VerifyEnvironment(walletFile, dataDir, errorStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWalletDB::VerifyDatabaseFile(const std::string& walletFile, const boost::filesystem::path& dataDir, std::string& warningStr, std::string& errorStr)
|
bool CWalletDB::VerifyDatabaseFile(const std::string& walletFile, const fs::path& dataDir, std::string& warningStr, std::string& errorStr)
|
||||||
{
|
{
|
||||||
return CDB::VerifyDatabaseFile(walletFile, dataDir, errorStr, warningStr, CWalletDB::Recover);
|
return CDB::VerifyDatabaseFile(walletFile, dataDir, errorStr, warningStr, CWalletDB::Recover);
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,9 +185,9 @@ public:
|
||||||
/* Function to determine if a certain KV/key-type is a key (cryptographical key) type */
|
/* Function to determine if a certain KV/key-type is a key (cryptographical key) type */
|
||||||
static bool IsKeyType(const std::string& strType);
|
static bool IsKeyType(const std::string& strType);
|
||||||
/* verifies the database environment */
|
/* verifies the database environment */
|
||||||
static bool VerifyEnvironment(const std::string& walletFile, const boost::filesystem::path& dataDir, std::string& errorStr);
|
static bool VerifyEnvironment(const std::string& walletFile, const fs::path& dataDir, std::string& errorStr);
|
||||||
/* verifies the database file */
|
/* verifies the database file */
|
||||||
static bool VerifyDatabaseFile(const std::string& walletFile, const boost::filesystem::path& dataDir, std::string& warningStr, std::string& errorStr);
|
static bool VerifyDatabaseFile(const std::string& walletFile, const fs::path& dataDir, std::string& warningStr, std::string& errorStr);
|
||||||
|
|
||||||
//! write the hdchain model (external chain child index counter)
|
//! write the hdchain model (external chain child index counter)
|
||||||
bool WriteHDChain(const CHDChain& chain);
|
bool WriteHDChain(const CHDChain& chain);
|
||||||
|
|
Loading…
Reference in a new issue