| 554 | } |
| 555 | |
| 556 | void Datastore::beginWrite() |
| 557 | { |
| 558 | Events::OperationStart::post("fluxengine.view.status.writeDevice"_lang); |
| 559 | Datastore::runOnWorkerThread( |
| 560 | [] |
| 561 | { |
| 562 | busy = true; |
| 563 | failed = false; |
| 564 | DEFER(wtOperationStop()); |
| 565 | |
| 566 | try |
| 567 | { |
| 568 | wtRebuildConfiguration(true); |
| 569 | wtWaitForUiThreadToCatchUp(); |
| 570 | |
| 571 | auto fluxSinkFactory = FluxSinkFactory::create(globalConfig()); |
| 572 | auto encoder = Arch::createEncoder(globalConfig()); |
| 573 | std::shared_ptr<Decoder> decoder; |
| 574 | std::shared_ptr<FluxSource> verificationFluxSource; |
| 575 | if (globalConfig().hasDecoder() && |
| 576 | fluxSinkFactory->isHardware()) |
| 577 | { |
| 578 | decoder = Arch::createDecoder(globalConfig()); |
| 579 | verificationFluxSource = FluxSource::create( |
| 580 | globalConfig().getVerificationFluxSourceProto()); |
| 581 | } |
| 582 | |
| 583 | auto path = fluxSinkFactory->getPath(); |
| 584 | if (path.has_value() && std::filesystem::exists(*path)) |
| 585 | { |
| 586 | { |
| 587 | bool result; |
| 588 | wtRunSynchronouslyOnUiThread(( |
| 589 | std::function<void()>)[&] { |
| 590 | hex::ui::PopupQuestion::open( |
| 591 | "fluxengine.messages.writingFluxToFile"_lang, |
| 592 | [&] |
| 593 | { |
| 594 | result = true; |
| 595 | }, |
| 596 | [&] |
| 597 | { |
| 598 | result = false; |
| 599 | }); |
| 600 | }); |
| 601 | if (!result) |
| 602 | throw EmergencyStopException(); |
| 603 | } |
| 604 | } |
| 605 | |
| 606 | auto image = disk->image; |
| 607 | writeDiskCommand(*diskLayout, |
| 608 | *image, |
| 609 | *encoder, |
| 610 | *fluxSinkFactory, |
| 611 | decoder.get(), |
| 612 | verificationFluxSource.get()); |
| 613 | } |
nothing calls this directly
no test coverage detected