Merge #11829: Test datadir specified in conf file exists
529b866
Test datadir in conf file exists (MeshCollider)
Pull request description:
Provoked by Nick ODell's discovery here: https://bitcoin.stackexchange.com/questions/64189/when-running-bitcoind-i-keep-getting-boostfilesystemspace-operation-not-p/64210#64210
If a custom data directory is specified using `-datadir` argument, its existence is checked before the conf file is loaded. But if the conf file then specifies a different non-existent `datadir`, that isn't tested, and results in esoteric errors like:
EXCEPTION: N5boost10filesystem16filesystem_errorE
boost::filesystem::space: Operation not permitted
This just adds a check for the datadir existence at the end of `ReadConfigFile()`
Tree-SHA512: e488618c40aa356263f94040ae00aa4be98038abef66e8674b01032d22a5553a7fafcb8fe2d1f095865b39fb138c07b7a94415a00ef837573f92f95af065f712
This commit is contained in:
commit
7630a1fe9a
1 changed files with 3 additions and 0 deletions
|
@ -639,6 +639,9 @@ void ArgsManager::ReadConfigFile(const std::string& confPath)
|
||||||
}
|
}
|
||||||
// If datadir is changed in .conf file:
|
// If datadir is changed in .conf file:
|
||||||
ClearDatadirCache();
|
ClearDatadirCache();
|
||||||
|
if (!fs::is_directory(GetDataDir(false))) {
|
||||||
|
throw std::runtime_error(strprintf("specified data directory \"%s\" does not exist.", gArgs.GetArg("-datadir", "").c_str()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
|
Loading…
Reference in a new issue