mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-19 03:20:37 +00:00
Persist the datadir after option reset
Github-Pull: #8487 Rebased-From: 15df3c196b2359505980a2b0217133e0bb550565 57acb82e7014f3214229349485fa3f57842b10ae
This commit is contained in:
parent
d9f0d4e073
commit
a37cec537b
@ -178,7 +178,7 @@ bool Intro::pickDataDirectory()
|
||||
/* 2) Allow QSettings to override default dir */
|
||||
dataDir = settings.value("strDataDir", dataDir).toString();
|
||||
|
||||
if(!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || GetBoolArg("-choosedatadir", DEFAULT_CHOOSE_DATADIR))
|
||||
if(!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || GetBoolArg("-choosedatadir", DEFAULT_CHOOSE_DATADIR) || settings.value("fReset", false).toBool() || GetBoolArg("-resetguisettings", false))
|
||||
{
|
||||
/* If current default data directory does not exist, let the user choose one */
|
||||
Intro intro;
|
||||
@ -204,6 +204,7 @@ bool Intro::pickDataDirectory()
|
||||
}
|
||||
|
||||
settings.setValue("strDataDir", dataDir);
|
||||
settings.setValue("fReset", false);
|
||||
}
|
||||
/* Only override -datadir if different from the default, to make it possible to
|
||||
* override -datadir in the bitcoin.conf file in the default data directory
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "main.h" // For DEFAULT_SCRIPTCHECK_THREADS
|
||||
#include "net.h"
|
||||
#include "txdb.h" // for -dbcache defaults
|
||||
#include "intro.h"
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
#include "wallet/wallet.h"
|
||||
@ -98,6 +99,9 @@ void OptionsModel::Init(bool resetSettings)
|
||||
if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString()))
|
||||
addOverriddenOption("-par");
|
||||
|
||||
if (!settings.contains("strDataDir"))
|
||||
settings.setValue("strDataDir", Intro::getDefaultDataDirectory());
|
||||
|
||||
// Wallet
|
||||
#ifdef ENABLE_WALLET
|
||||
if (!settings.contains("bSpendZeroConfChange"))
|
||||
@ -150,9 +154,19 @@ void OptionsModel::Reset()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
// Save the strDataDir setting
|
||||
QString dataDir = Intro::getDefaultDataDirectory();
|
||||
dataDir = settings.value("strDataDir", dataDir).toString();
|
||||
|
||||
// Remove all entries from our QSettings object
|
||||
settings.clear();
|
||||
|
||||
// Set strDataDir
|
||||
settings.setValue("strDataDir", dataDir);
|
||||
|
||||
// Set that this was reset
|
||||
settings.setValue("fReset", true);
|
||||
|
||||
// default setting for OptionsModel::StartAtStartup - disabled
|
||||
if (GUIUtil::GetStartOnSystemStartup())
|
||||
GUIUtil::SetStartOnSystemStartup(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user