{
printf("EnvShutdown exception: %s (%d)\n", e.what(), e.get_errno());
}
- DbEnv(0).remove(GetDataDir().c_str(), 0);
+ DbEnv(0).remove(GetDataDir().string().c_str(), 0);
}
class CDBInit
instance_of_cdbinit;
-CDB::CDB(const char* pszFile, const char* pszMode) : pdb(NULL)
+CDB::CDB(const char *pszFile, const char* pszMode) : pdb(NULL)
{
int ret;
if (pszFile == NULL)
{
if (fShutdown)
return;
- string strDataDir = GetDataDir();
- filesystem::path pathLogDir(strDataDir + "/database");
- pathLogDir.make_preferred();
+ filesystem::path pathDataDir = GetDataDir();
+ filesystem::path pathLogDir = pathDataDir / "database";
filesystem::create_directory(pathLogDir);
- filesystem::path pathErrorFile(strDataDir + "/db.log");
- pathErrorFile.make_preferred();
+ filesystem::path pathErrorFile = pathDataDir / "db.log";
printf("dbenv.open LogDir=%s ErrorFile=%s\n", pathLogDir.string().c_str(), pathErrorFile.string().c_str());
int nDbCache = GetArg("-dbcache", 25);
dbenv.set_errfile(fopen(pathErrorFile.string().c_str(), "a")); /// debug
dbenv.set_flags(DB_AUTO_COMMIT, 1);
dbenv.log_set_config(DB_LOG_AUTO_REMOVE, 1);
- ret = dbenv.open(strDataDir.c_str(),
+ ret = dbenv.open(pathDataDir.string().c_str(),
DB_CREATE |
DB_INIT_LOCK |
DB_INIT_LOG |
// check level 4: check whether spent txouts were spent within the main chain
int nOutput = 0;
if (nCheckLevel>3)
+ {
BOOST_FOREACH(const CDiskTxPos &txpos, txindex.vSpent)
{
if (!txpos.IsNull())
}
nOutput++;
}
+ }
}
// check level 5: check whether all prevouts are marked spent
if (nCheckLevel>4)
+ {
BOOST_FOREACH(const CTxIn &txin, tx.vin)
{
CTxIndex txindex;
pindexFork = pindex->pprev;
}
}
+ }
}
}
}
return DB_NEED_REWRITE;
if (nFileVersion < CLIENT_VERSION) // Update
- {
- // Get rid of old debug.log file in current directory
- if (nFileVersion <= 105 && !pszSetDataDir[0])
- unlink("debug.log");
-
WriteVersion(CLIENT_VERSION);
- }
return DB_LOAD_OK;
}
mapFileUseCount.erase(wallet.strWalletFile);
// Copy wallet.dat
- filesystem::path pathSrc(GetDataDir() + "/" + wallet.strWalletFile);
- pathSrc.make_preferred();
+ filesystem::path pathSrc = GetDataDir() / wallet.strWalletFile;
filesystem::path pathDest(strDest);
- pathDest.make_preferred();
if (filesystem::is_directory(pathDest))
- pathDest = pathDest / wallet.strWalletFile;
+ pathDest /= wallet.strWalletFile;
try {
#if BOOST_VERSION >= 104000