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;
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)
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);
}
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)
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;
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()) {
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;
}