Skip to content

Commit 7630a1f

Browse files
committed
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
2 parents 497d0e0 + 529b866 commit 7630a1f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/util.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,9 @@ void ArgsManager::ReadConfigFile(const std::string& confPath)
639639
}
640640
// If datadir is changed in .conf file:
641641
ClearDatadirCache();
642+
if (!fs::is_directory(GetDataDir(false))) {
643+
throw std::runtime_error(strprintf("specified data directory \"%s\" does not exist.", gArgs.GetArg("-datadir", "").c_str()));
644+
}
642645
}
643646

644647
#ifndef WIN32

0 commit comments

Comments
 (0)