Skip to content

Commit 15df3c1

Browse files
committed
Persist the datadir after option reset
After a reset is performed, the datadir setting is saved and readded to the settings so that it is persisted across option resets.
1 parent edebf42 commit 15df3c1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/qt/optionsmodel.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "main.h" // For DEFAULT_SCRIPTCHECK_THREADS
1717
#include "net.h"
1818
#include "txdb.h" // for -dbcache defaults
19+
#include "intro.h"
1920

2021
#ifdef ENABLE_WALLET
2122
#include "wallet/wallet.h"
@@ -98,6 +99,9 @@ void OptionsModel::Init(bool resetSettings)
9899
if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString()))
99100
addOverriddenOption("-par");
100101

102+
if (!settings.contains("strDataDir"))
103+
settings.setValue("strDataDir", Intro::getDefaultDataDirectory());
104+
101105
// Wallet
102106
#ifdef ENABLE_WALLET
103107
if (!settings.contains("bSpendZeroConfChange"))
@@ -150,9 +154,16 @@ void OptionsModel::Reset()
150154
{
151155
QSettings settings;
152156

157+
// Save the strDataDir setting
158+
QString dataDir = Intro::getDefaultDataDirectory();
159+
dataDir = settings.value("strDataDir", dataDir).toString();
160+
153161
// Remove all entries from our QSettings object
154162
settings.clear();
155163

164+
// Set strDataDir
165+
settings.setValue("strDataDir", dataDir);
166+
156167
// default setting for OptionsModel::StartAtStartup - disabled
157168
if (GUIUtil::GetStartOnSystemStartup())
158169
GUIUtil::SetStartOnSystemStartup(false);

0 commit comments

Comments
 (0)