mirror of https://github.com/PCSX2/pcsx2.git
Qt: Remove backup AppImage on next launch
This commit is contained in:
parent
b02af117f8
commit
7cdcfd4b1a
|
@ -595,6 +595,11 @@ bool AutoUpdaterDialog::doUpdate(const QString& zip_path, const QString& updater
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AutoUpdaterDialog::cleanupAfterUpdate()
|
||||||
|
{
|
||||||
|
// Nothing to do on Windows for now, the updater stub cleans everything up.
|
||||||
|
}
|
||||||
|
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
|
|
||||||
bool AutoUpdaterDialog::processUpdate(const QByteArray& update_data, QProgressDialog&)
|
bool AutoUpdaterDialog::processUpdate(const QByteArray& update_data, QProgressDialog&)
|
||||||
|
@ -663,6 +668,7 @@ bool AutoUpdaterDialog::processUpdate(const QByteArray& update_data, QProgressDi
|
||||||
// Execute new appimage.
|
// Execute new appimage.
|
||||||
QProcess* new_process = new QProcess();
|
QProcess* new_process = new QProcess();
|
||||||
new_process->setProgram(qappimage_path);
|
new_process->setProgram(qappimage_path);
|
||||||
|
new_process->setArguments(QStringList{QStringLiteral("-updatecleanup")});
|
||||||
if (!new_process->startDetached())
|
if (!new_process->startDetached())
|
||||||
{
|
{
|
||||||
reportError("Failed to execute new AppImage.");
|
reportError("Failed to execute new AppImage.");
|
||||||
|
@ -673,6 +679,23 @@ bool AutoUpdaterDialog::processUpdate(const QByteArray& update_data, QProgressDi
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AutoUpdaterDialog::cleanupAfterUpdate()
|
||||||
|
{
|
||||||
|
// Remove old/backup AppImage.
|
||||||
|
const char* appimage_path = std::getenv("APPIMAGE");
|
||||||
|
if (!appimage_path)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const QString qappimage_path(QString::fromUtf8(appimage_path));
|
||||||
|
const QString backup_appimage_path(qappimage_path + QStringLiteral(".backup"));
|
||||||
|
if (!QFile::exists(backup_appimage_path))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Console.WriteLn(Color_StrongOrange, QStringLiteral("Removing backup AppImage %1").arg(backup_appimage_path).toStdString());
|
||||||
|
if (!QFile::remove(backup_appimage_path))
|
||||||
|
Console.Error(QStringLiteral("Failed to remove backup AppImage %1").arg(backup_appimage_path).toStdString());
|
||||||
|
}
|
||||||
|
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
|
|
||||||
static QString UpdateVersionNumberInName(QString name, QStringView new_version)
|
static QString UpdateVersionNumberInName(QString name, QStringView new_version)
|
||||||
|
@ -789,6 +812,10 @@ bool AutoUpdaterDialog::processUpdate(const QByteArray& update_data, QProgressDi
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AutoUpdaterDialog::cleanupAfterUpdate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
bool AutoUpdaterDialog::processUpdate(const QByteArray& update_data, QProgressDialog& progress)
|
bool AutoUpdaterDialog::processUpdate(const QByteArray& update_data, QProgressDialog& progress)
|
||||||
|
@ -796,4 +823,8 @@ bool AutoUpdaterDialog::processUpdate(const QByteArray& update_data, QProgressDi
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AutoUpdaterDialog::cleanupAfterUpdate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,6 +37,7 @@ public:
|
||||||
static std::string getDefaultTag();
|
static std::string getDefaultTag();
|
||||||
static QString getCurrentVersion();
|
static QString getCurrentVersion();
|
||||||
static QString getCurrentVersionDate();
|
static QString getCurrentVersionDate();
|
||||||
|
static void cleanupAfterUpdate();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void updateCheckCompleted();
|
void updateCheckCompleted();
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
|
|
||||||
#include "fmt/core.h"
|
#include "fmt/core.h"
|
||||||
|
|
||||||
|
#include "AutoUpdaterDialog.h"
|
||||||
#include "DisplayWidget.h"
|
#include "DisplayWidget.h"
|
||||||
#include "GameList/GameListWidget.h"
|
#include "GameList/GameListWidget.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
@ -1755,6 +1756,13 @@ bool QtHost::ParseCommandLineOptions(const QStringList& args, std::shared_ptr<VM
|
||||||
s_boot_and_debug = true;
|
s_boot_and_debug = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (CHECK_ARG(QStringLiteral("-updatecleanup")))
|
||||||
|
{
|
||||||
|
if (AutoUpdaterDialog::isSupported())
|
||||||
|
AutoUpdaterDialog::cleanupAfterUpdate();
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
#ifdef ENABLE_RAINTEGRATION
|
#ifdef ENABLE_RAINTEGRATION
|
||||||
else if (CHECK_ARG(QStringLiteral("-raintegration")))
|
else if (CHECK_ARG(QStringLiteral("-raintegration")))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue