Fix datadir handling in bitcoin-cli

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.
This commit is contained in:
Hennadii Stepanov 2019-07-24 18:54:46 +03:00
parent b28dada374
commit 7e33a18a34
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

View File

@ -123,7 +123,7 @@ static int AppInitRPC(int argc, char* argv[])
}
return EXIT_SUCCESS;
}
if (!fs::is_directory(GetDataDir(false))) {
if (!CheckDataDirOption()) {
tfm::format(std::cerr, "Error: Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", "").c_str());
return EXIT_FAILURE;
}