File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -578,7 +578,8 @@ int main(int argc, char *argv[])
578
578
579
579
// / 5. Now that settings and translations are available, ask user for data directory
580
580
// User language is set up: pick a data directory
581
- Intro::pickDataDirectory ();
581
+ if (!Intro::pickDataDirectory ())
582
+ return 0 ;
582
583
583
584
// / 6. Determine availability of data directory and parse bitcoin.conf
584
585
// / - Do not call GetDataDir(true) before this step finishes
Original file line number Diff line number Diff line change @@ -165,14 +165,14 @@ QString Intro::getDefaultDataDirectory()
165
165
return GUIUtil::boostPathToQString (GetDefaultDataDir ());
166
166
}
167
167
168
- void Intro::pickDataDirectory ()
168
+ bool Intro::pickDataDirectory ()
169
169
{
170
170
namespace fs = boost::filesystem;
171
171
QSettings settings;
172
172
/* If data directory provided on command line, no need to look at settings
173
173
or show a picking dialog */
174
174
if (!GetArg (" -datadir" , " " ).empty ())
175
- return ;
175
+ return true ;
176
176
/* 1) Default data directory for operating system */
177
177
QString dataDir = getDefaultDataDirectory ();
178
178
/* 2) Allow QSettings to override default dir */
@@ -190,7 +190,7 @@ void Intro::pickDataDirectory()
190
190
if (!intro.exec ())
191
191
{
192
192
/* Cancel clicked */
193
- exit ( 0 ) ;
193
+ return false ;
194
194
}
195
195
dataDir = intro.getDataDirectory ();
196
196
try {
@@ -211,6 +211,7 @@ void Intro::pickDataDirectory()
211
211
*/
212
212
if (dataDir != getDefaultDataDirectory ())
213
213
SoftSetArg (" -datadir" , GUIUtil::qstringToBoostPath (dataDir).string ()); // use OS locale for path setting
214
+ return true ;
214
215
}
215
216
216
217
void Intro::setStatus (int status, const QString &message, quint64 bytesAvailable)
Original file line number Diff line number Diff line change @@ -35,10 +35,13 @@ class Intro : public QDialog
35
35
/* *
36
36
* Determine data directory. Let the user choose if the current one doesn't exist.
37
37
*
38
+ * @returns true if a data directory was selected, false if the user cancelled the selection
39
+ * dialog.
40
+ *
38
41
* @note do NOT call global GetDataDir() before calling this function, this
39
42
* will cause the wrong path to be cached.
40
43
*/
41
- static void pickDataDirectory ();
44
+ static bool pickDataDirectory ();
42
45
43
46
/* *
44
47
* Determine default data directory for operating system.
You can’t perform that action at this time.
0 commit comments