MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / wtRebuildConfiguration

Function wtRebuildConfiguration

src/gui2/datastore.cc:346–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344}
345
346void wtRebuildConfiguration(bool withCustom = false)
347{
348 /* Reset and apply the format configuration. */
349
350 auto formatName =
351 readSettingFromUiThread<std::string>("format.selected", "ibm");
352 if (formatName.empty())
353 return;
354 globalConfig().clear();
355 globalConfig().readBaseConfigFile("_global_options");
356 globalConfig().readBaseConfigFile(formatName);
357
358 /* Device-specific settings. */
359
360 auto device = readSettingFromUiThread<std::string>("device", "fluxfile");
361 if (device.empty())
362 return;
363 if (device == "fluxfile")
364 {
365 auto fluxfile =
366 readSettingFromUiThread<std::fs::path>("fluxfile", "unset")
367 .string();
368 globalConfig().setFluxSink(fluxfile);
369 globalConfig().setFluxSource(fluxfile);
370 globalConfig().setVerificationFluxSource(fluxfile);
371 }
372 else
373 {
374 auto highDensity = readSettingFromUiThread<bool>("highDensity", true);
375 globalConfig().overrides()->mutable_drive()->set_high_density(
376 highDensity);
377
378 if (device[0] == '#')
379 {
380 auto serial = device.substr(1);
381 globalConfig().overrides()->mutable_usb()->set_serial(serial);
382 globalConfig().setFluxSink("drive:0");
383 globalConfig().setFluxSource("drive:0");
384 globalConfig().setVerificationFluxSource("drive:0");
385 }
386 }
387
388 /* Selected options. */
389
390 auto options = stringToOptions(
391 readSettingFromUiThread<std::string>("globalSettings", ""));
392 options.merge(
393 stringToOptions(readSettingFromUiThread<std::string>(formatName, "")));
394
395 for (const auto& [key, value] : options)
396 globalConfig().applyOption(key, value);
397
398 /* Custom settings. */
399
400 globalConfig().applyOptionsFile(
401 readSettingFromUiThread<std::string>("systemProperties", ""));
402 globalConfig().applyOptionsFile(
403 readSettingFromUiThread<std::string>("custom", ""));

Callers 8

initMethod · 0.85
beginReadMethod · 0.85
beginWriteMethod · 0.85
resetMethod · 0.85
writeImageMethod · 0.85
readImageMethod · 0.85
writeFluxFileMethod · 0.85
createBlankImageMethod · 0.85

Calls 14

stringToOptionsFunction · 0.85
createDiskLayoutFunction · 0.85
readBaseConfigFileMethod · 0.80
setFluxSinkMethod · 0.80
setFluxSourceMethod · 0.80
overridesMethod · 0.80
applyOptionMethod · 0.80
applyOptionsFileMethod · 0.80
applyDefaultOptionsMethod · 0.80
validateAndThrowMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected