@@ -90,6 +90,26 @@ void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, cons
9090 LogPrintf (" GUI: %s\n " , msg.toStdString ());
9191 }
9292}
93+
94+ bool ConfigurationFileExists (ArgsManager& argsman)
95+ {
96+ fs::path settings_path;
97+ if (!argsman.GetSettingsPath (&settings_path)) {
98+ // settings file is disabled
99+ return true ;
100+ }
101+ if (fs::exists (settings_path)) {
102+ return true ;
103+ }
104+
105+ const fs::path rel_config_path = argsman.GetPathArg (" -conf" , BITCOIN_CONF_FILENAME );
106+ const fs::path abs_config_path = AbsPathForConfigVal (rel_config_path, true );
107+ if (fs::exists (abs_config_path)) {
108+ return true ;
109+ }
110+
111+ return false ;
112+ }
93113} // namespace
94114
95115
@@ -144,11 +164,19 @@ int QmlGuiMain(int argc, char* argv[])
144164 }
145165
146166 // / Read and parse settings.json file.
147- if (!gArgs .InitSettings (error)) {
167+ std::vector<std::string> errors;
168+ if (!gArgs .ReadSettingsFile (&errors)) {
169+ error = strprintf (" Failed loading settings file:\n %s\n " , MakeUnorderedList (errors));
148170 InitError (Untranslated (error));
149171 return EXIT_FAILURE ;
150172 }
151173
174+ QVariant need_onboarding (true );
175+ if (gArgs .IsArgSet (" -datadir" ) && !gArgs .GetPathArg (" -datadir" ).empty ()) {
176+ need_onboarding.setValue (false );
177+ } else if (ConfigurationFileExists (gArgs )) {
178+ need_onboarding.setValue (false );
179+ }
152180 // Default printtoconsole to false for the GUI. GUI programs should not
153181 // print to the console unnecessarily.
154182 gArgs .SoftSetBoolArg (" -printtoconsole" , false );
@@ -199,6 +227,7 @@ int QmlGuiMain(int argc, char* argv[])
199227 OptionsQmlModel options_model{*node};
200228 engine.rootContext ()->setContextProperty (" optionsModel" , &options_model);
201229
230+ engine.rootContext ()->setContextProperty (" needOnboarding" , need_onboarding);
202231#ifdef __ANDROID__
203232 AppMode app_mode (AppMode::MOBILE );
204233#else
0 commit comments