| 602 | } |
| 603 | |
| 604 | bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& data, QProgressDialog&) |
| 605 | { |
| 606 | const std::string& application_dir = EmuFolders::AppRoot; |
| 607 | const std::string update_zip_path = Path::Combine(EmuFolders::DataRoot, UPDATER_ARCHIVE_NAME); |
| 608 | const std::string updater_path = Path::Combine(EmuFolders::DataRoot, UPDATER_EXECUTABLE); |
| 609 | |
| 610 | if ((FileSystem::FileExists(update_zip_path.c_str()) && !FileSystem::DeleteFilePath(update_zip_path.c_str()))) |
| 611 | { |
| 612 | reportError("Removing existing update zip failed"); |
| 613 | return false; |
| 614 | } |
| 615 | |
| 616 | if (!FileSystem::WriteBinaryFile(update_zip_path.c_str(), data.data(), data.size())) |
| 617 | { |
| 618 | reportError("Writing update zip to '%s' failed", update_zip_path.c_str()); |
| 619 | return false; |
| 620 | } |
| 621 | |
| 622 | std::string updater_extract_error; |
| 623 | if (!ExtractUpdater(update_zip_path.c_str(), updater_path.c_str(), &updater_extract_error)) |
| 624 | { |
| 625 | reportError("Extracting updater failed: %s", updater_extract_error.c_str()); |
| 626 | return false; |
| 627 | } |
| 628 | |
| 629 | return doUpdate(application_dir, update_zip_path, updater_path); |
| 630 | } |
| 631 | |
| 632 | bool AutoUpdaterDialog::doUpdate(const std::string& application_dir, const std::string& zip_path, const std::string& updater_path) |
| 633 | { |
nothing calls this directly
no test coverage detected