MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / processUpdate

Method processUpdate

pcsx2-qt/AutoUpdaterDialog.cpp:604–630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

602}
603
604bool 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
632bool AutoUpdaterDialog::doUpdate(const std::string& application_dir, const std::string& zip_path, const std::string& updater_path)
633{

Callers

nothing calls this directly

Calls 15

CombineFunction · 0.85
ExtractUpdaterFunction · 0.85
isValidMethod · 0.80
minFunction · 0.50
c_strMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
WriteLnMethod · 0.45
openMethod · 0.45
writeMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected