From cb918bdbc800c3a0b81d9155c6f03809a0757cc7 Mon Sep 17 00:00:00 2001 From: Collecting Date: Thu, 11 Dec 2025 05:25:57 +0000 Subject: [PATCH] feat: Add Backup Location Path Notification for Linux Updates Implements a new feature for the Updater for Linux users, that notifies them of the directory of where their backup folder has been made & stores their last version of the emulator. This folder is not stagnant, for now, it makes a backup folder wherever the AppImage is, so it'll create a new one if the AppImage is moved to a separate location. Can be looked into in the future to make it so users can select a location. For now, this works. Signed-off-by: Collecting --- src/citron/updater/updater_dialog.cpp | 29 +++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/citron/updater/updater_dialog.cpp b/src/citron/updater/updater_dialog.cpp index 49ad20c25..2284848c1 100644 --- a/src/citron/updater/updater_dialog.cpp +++ b/src/citron/updater/updater_dialog.cpp @@ -1,6 +1,8 @@ // SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include + #include "citron/updater/updater_dialog.h" #include "ui_updater_dialog.h" @@ -8,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -361,11 +364,29 @@ void UpdaterDialog::ShowCompletedState() { } }); #else - // On Linux, show the restart button as before + // On Linux, show the restart button and provide backup information. ui->titleLabel->setText(QStringLiteral("Update ready!")); - ui->statusLabel->setText(QStringLiteral("The update has been downloaded and prepared " - "successfully. The update will be applied when you " - "restart Citron.")); + + QString status_message = QStringLiteral( + "The update has been downloaded and prepared successfully. " + "The update will be applied when you restart Citron."); + + // Check for the APPIMAGE env var to locate the backup directory. + QByteArray appimage_path_env = qgetenv("APPIMAGE"); + if (!appimage_path_env.isEmpty()) { + std::filesystem::path appimage_path(appimage_path_env.constData()); + std::filesystem::path backup_dir = appimage_path.parent_path() / "backup"; + + // Use QDir to present the path in a native format for the user. + QString native_backup_path = QDir::toNativeSeparators(QString::fromStdString(backup_dir.string())); + + status_message.append( + QStringLiteral("\n\nA backup of the previous version has been saved to:\n%1") + .arg(native_backup_path)); + } + + ui->statusLabel->setText(status_message); + ui->progressGroup->setVisible(false); ui->downloadButton->setVisible(false); ui->cancelButton->setVisible(false);