mirror of
https://github.com/citra-mirror/citra.git
synced 2024-08-20 18:33:24 +02:00
qt: Support updating an installed app image. (#6915)
This commit is contained in:
parent
a94297922b
commit
edf157200d
@ -14,6 +14,7 @@
|
|||||||
#include "citra_qt/uisettings.h"
|
#include "citra_qt/uisettings.h"
|
||||||
#include "citra_qt/updater/updater.h"
|
#include "citra_qt/updater/updater.h"
|
||||||
#include "citra_qt/updater/updater_p.h"
|
#include "citra_qt/updater/updater_p.h"
|
||||||
|
#include "common/file_util.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
|
|
||||||
#ifdef Q_OS_OSX
|
#ifdef Q_OS_OSX
|
||||||
@ -110,9 +111,22 @@ QString UpdaterPrivate::ToSystemExe(QString base_path) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QFileInfo UpdaterPrivate::GetMaintenanceTool() const {
|
||||||
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_OSX)
|
||||||
|
const auto appimage_path = QProcessEnvironment::systemEnvironment()
|
||||||
|
.value(QStringLiteral("APPIMAGE"), {})
|
||||||
|
.toStdString();
|
||||||
|
if (!appimage_path.empty()) {
|
||||||
|
const auto appimage_dir = FileUtil::GetParentPath(appimage_path);
|
||||||
|
LOG_DEBUG(Frontend, "Detected app image directory: {}", appimage_dir);
|
||||||
|
return QFileInfo(QString::fromStdString(std::string(appimage_dir)), tool_path);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return QFileInfo(QCoreApplication::applicationDirPath(), tool_path);
|
||||||
|
}
|
||||||
|
|
||||||
bool UpdaterPrivate::HasUpdater() const {
|
bool UpdaterPrivate::HasUpdater() const {
|
||||||
QFileInfo tool_info(QCoreApplication::applicationDirPath(), tool_path);
|
return GetMaintenanceTool().exists();
|
||||||
return tool_info.exists();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UpdaterPrivate::StartUpdateCheck() {
|
bool UpdaterPrivate::StartUpdateCheck() {
|
||||||
@ -125,9 +139,8 @@ bool UpdaterPrivate::StartUpdateCheck() {
|
|||||||
last_error_code = EXIT_SUCCESS;
|
last_error_code = EXIT_SUCCESS;
|
||||||
last_error_log.clear();
|
last_error_log.clear();
|
||||||
|
|
||||||
QFileInfo tool_info(QCoreApplication::applicationDirPath(), tool_path);
|
|
||||||
main_process = new QProcess(this);
|
main_process = new QProcess(this);
|
||||||
main_process->setProgram(tool_info.absoluteFilePath());
|
main_process->setProgram(GetMaintenanceTool().absoluteFilePath());
|
||||||
main_process->setArguments({QStringLiteral("--checkupdates"), QStringLiteral("-v")});
|
main_process->setArguments({QStringLiteral("--checkupdates"), QStringLiteral("-v")});
|
||||||
|
|
||||||
connect(main_process, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this,
|
connect(main_process, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this,
|
||||||
@ -271,7 +284,7 @@ void UpdaterPrivate::LaunchWithArguments(const QStringList& args) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo tool_info(QCoreApplication::applicationDirPath(), tool_path);
|
QFileInfo tool_info = GetMaintenanceTool();
|
||||||
|
|
||||||
if (!QProcess::startDetached(tool_info.absoluteFilePath(), args, tool_info.absolutePath())) {
|
if (!QProcess::startDetached(tool_info.absoluteFilePath(), args, tool_info.absolutePath())) {
|
||||||
LOG_WARNING(Frontend, "Unable to start program {}",
|
LOG_WARNING(Frontend, "Unable to start program {}",
|
||||||
|
@ -26,6 +26,7 @@ public:
|
|||||||
|
|
||||||
static QString ToSystemExe(QString base_path);
|
static QString ToSystemExe(QString base_path);
|
||||||
|
|
||||||
|
QFileInfo GetMaintenanceTool() const;
|
||||||
bool HasUpdater() const;
|
bool HasUpdater() const;
|
||||||
|
|
||||||
bool StartUpdateCheck();
|
bool StartUpdateCheck();
|
||||||
|
Loading…
Reference in New Issue
Block a user