From 6855bac278b5df8697c7757ca73e9983b4858ea3 Mon Sep 17 00:00:00 2001 From: collecting Date: Mon, 27 Oct 2025 03:08:55 +0000 Subject: [PATCH] fix: AppImage --- src/citron/updater/updater_dialog.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/citron/updater/updater_dialog.cpp b/src/citron/updater/updater_dialog.cpp index af01fd831..1634cc2d8 100644 --- a/src/citron/updater/updater_dialog.cpp +++ b/src/citron/updater/updater_dialog.cpp @@ -48,8 +48,7 @@ UpdaterDialog::UpdaterDialog(QWidget* parent) ui->setupUi(this); - // NEW: Disable the default link handling behavior of the QTextBrowser. - // This prevents it from trying to load the URL internally. + // Disable the default link handling behavior of the QTextBrowser. ui->changelogText->setOpenLinks(false); // Manually handle link clicks to ensure they always open in an external browser. @@ -192,7 +191,18 @@ void UpdaterDialog::OnRestartButtonClicked() { QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); if (ret == QMessageBox::Yes) { - QString program = QApplication::applicationFilePath(); + + QString program; + QByteArray appimage_path = qgetenv("APPIMAGE"); + + if (!appimage_path.isEmpty()) { + // We are running from an AppImage. The program to restart is the AppImage file itself. + program = QString::fromUtf8(appimage_path); + } else { + // Not an AppImage (e.g., Windows or a non-AppImage Linux build), use the default method. + program = QApplication::applicationFilePath(); + } + QStringList arguments = QApplication::arguments(); arguments.removeFirst();