Qt: Remove update.zip after updating
This commit is contained in:
parent
885addcfce
commit
ac1fd7f0cf
|
@ -707,9 +707,6 @@ bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& update_data)
|
|||
|
||||
void AutoUpdaterDialog::cleanupAfterUpdate()
|
||||
{
|
||||
const QString zip_path = QString::fromStdString(Path::Combine(EmuFolders::DataRoot, "update.zip"));
|
||||
if (QFile::exists(zip_path))
|
||||
QFile::remove(zip_path);
|
||||
}
|
||||
|
||||
#elif defined(__linux__)
|
||||
|
|
|
@ -113,6 +113,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
updater.CleanupStagingDirectory();
|
||||
updater.RemoveUpdateZip();
|
||||
|
||||
result = EXIT_SUCCESS;
|
||||
});
|
||||
|
|
|
@ -37,8 +37,7 @@ Updater::Updater(ProgressCallback* progress) : m_progress(progress)
|
|||
|
||||
Updater::~Updater()
|
||||
{
|
||||
if (m_zf)
|
||||
unzClose(m_zf);
|
||||
CloseUpdateZip();
|
||||
}
|
||||
|
||||
bool Updater::Initialize(std::string staging_directory, std::string destination_directory)
|
||||
|
@ -56,10 +55,32 @@ bool Updater::OpenUpdateZip(const char* path)
|
|||
if (!m_zf)
|
||||
return false;
|
||||
|
||||
m_zip_path = path;
|
||||
|
||||
m_progress->SetStatusText("Parsing update zip...");
|
||||
return ParseZip();
|
||||
}
|
||||
|
||||
void Updater::CloseUpdateZip()
|
||||
{
|
||||
if (m_zf)
|
||||
{
|
||||
unzClose(m_zf);
|
||||
m_zf = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void Updater::RemoveUpdateZip()
|
||||
{
|
||||
if (m_zip_path.empty())
|
||||
return;
|
||||
|
||||
CloseUpdateZip();
|
||||
|
||||
if (!FileSystem::DeleteFile(m_zip_path.c_str()))
|
||||
m_progress->DisplayFormattedError("Failed to remove update zip '%s'", m_zip_path.c_str());
|
||||
}
|
||||
|
||||
bool Updater::RecursiveDeleteDirectory(const char* path, bool remove_dir)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -16,6 +16,7 @@ public:
|
|||
bool Initialize(std::string staging_directory, std::string destination_directory);
|
||||
|
||||
bool OpenUpdateZip(const char* path);
|
||||
void RemoveUpdateZip();
|
||||
bool PrepareStagingDirectory();
|
||||
bool StageUpdate();
|
||||
bool CommitUpdate();
|
||||
|
@ -33,7 +34,9 @@ private:
|
|||
};
|
||||
|
||||
bool ParseZip();
|
||||
void CloseUpdateZip();
|
||||
|
||||
std::string m_zip_path;
|
||||
std::string m_staging_directory;
|
||||
std::string m_destination_directory;
|
||||
|
||||
|
|
|
@ -93,6 +93,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
|
|||
}
|
||||
|
||||
updater.CleanupStagingDirectory();
|
||||
updater.RemoveUpdateZip();
|
||||
|
||||
progress.DisplayFormattedInformation("Launching '%s'...",
|
||||
StringUtil::WideStringToUTF8String(program_to_launch).c_str());
|
||||
|
|
Loading…
Reference in New Issue