Fix datadir handling in bitcoin-qt

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/15864/head
Hennadii Stepanov 5 years ago
parent 50824093bb
commit b28dada374
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

@ -495,10 +495,9 @@ int GuiMain(int argc, char* argv[])
if (!Intro::pickDataDirectory(*node)) if (!Intro::pickDataDirectory(*node))
return EXIT_SUCCESS; return EXIT_SUCCESS;
/// 6. Determine availability of data and blocks directory and parse bitcoin.conf /// 6. Determine availability of data directory and parse bitcoin.conf
/// - Do not call GetDataDir(true) before this step finishes /// - Do not call GetDataDir(true) before this step finishes
if (!fs::is_directory(GetDataDir(false))) if (!CheckDataDirOption()) {
{
node->initError(strprintf("Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", ""))); node->initError(strprintf("Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", "")));
QMessageBox::critical(nullptr, PACKAGE_NAME, QMessageBox::critical(nullptr, PACKAGE_NAME,
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", "")))); QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", ""))));

Loading…
Cancel
Save