Fix datadir handling in bitcoind

This prevents premature tries to access or create the default datadir.
This is useful when the -datadir option is specified and the default
datadir is unreachable.
pull/764/head
Hennadii Stepanov 5 years ago
parent 740d41ce9f
commit 50824093bb
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

@ -92,8 +92,7 @@ static bool AppInit(int argc, char* argv[])
try
{
if (!fs::is_directory(GetDataDir(false)))
{
if (!CheckDataDirOption()) {
return InitError(strprintf("Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", "")));
}
if (!gArgs.ReadConfigFiles(error, true)) {

@ -941,7 +941,7 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
// If datadir is changed in .conf file:
ClearDatadirCache();
if (!fs::is_directory(GetDataDir(false))) {
if (!CheckDataDirOption()) {
error = strprintf("specified data directory \"%s\" does not exist.", gArgs.GetArg("-datadir", "").c_str());
return false;
}

Loading…
Cancel
Save