MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / pickDataDirectory

Method pickDataDirectory

src/qt/intro.cpp:190–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190bool Intro::pickDataDirectory(interfaces::Node& node)
191{
192 QSettings settings;
193 /* If data directory provided on command line, no need to look at settings
194 or show a picking dialog */
195 if(!gArgs.GetArg("-datadir", "").empty())
196 return true;
197 /* 1) Default data directory for operating system */
198 QString dataDir = getDefaultDataDirectory();
199 /* 2) Allow QSettings to override default dir */
200 dataDir = settings.value("strDataDir", dataDir).toString();
201
202 if(!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || gArgs.GetBoolArg("-choosedatadir", DEFAULT_CHOOSE_DATADIR) || settings.value("fReset", false).toBool() || gArgs.GetBoolArg("-resetguisettings", false))
203 {
204 /* If current default data directory does not exist, let the user choose one */
205 Intro intro;
206 intro.setDataDirectory(dataDir);
207 intro.setWindowIcon(QIcon(":icons/bitcoin"));
208
209 while(true)
210 {
211 if(!intro.exec())
212 {
213 /* Cancel clicked */
214 return false;
215 }
216 dataDir = intro.getDataDirectory();
217 try {
218 if (TryCreateDirectories(GUIUtil::qstringToBoostPath(dataDir))) {
219 // If a new data directory has been created, make wallets subdirectory too
220 TryCreateDirectories(GUIUtil::qstringToBoostPath(dataDir) / "wallets");
221 }
222 break;
223 } catch (const fs::filesystem_error&) {
224 QMessageBox::critical(0, tr(PACKAGE_NAME),
225 tr("Error: Specified data directory \"%1\" cannot be created.").arg(dataDir));
226 /* fall through, back to choosing screen */
227 }
228 }
229
230 settings.setValue("strDataDir", dataDir);
231 settings.setValue("fReset", false);
232 }
233 /* Only override -datadir if different from the default, to make it possible to
234 * override -datadir in the bitcoingold.conf file in the default data directory
235 * (to be consistent with bgoldd behavior)
236 */
237 if(dataDir != getDefaultDataDirectory()) {
238 node.softSetArg("-datadir", GUIUtil::qstringToBoostPath(dataDir).string()); // use OS locale for path setting
239 }
240 return true;
241}
242
243void Intro::setStatus(int status, const QString &message, quint64 bytesAvailable)
244{

Callers

nothing calls this directly

Calls 11

qstringToBoostPathFunction · 0.85
TryCreateDirectoriesFunction · 0.85
GetBoolArgMethod · 0.80
setDataDirectoryMethod · 0.80
execMethod · 0.80
getDataDirectoryMethod · 0.80
softSetArgMethod · 0.80
emptyMethod · 0.45
GetArgMethod · 0.45
valueMethod · 0.45
setValueMethod · 0.45

Tested by

no test coverage detected