mirror of
https://git.citron-emu.org/citron/emulator
synced 2025-12-19 10:43:33 +00:00
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 <collecting@noreply.localhost>
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
#include "citron/updater/updater_dialog.h"
|
#include "citron/updater/updater_dialog.h"
|
||||||
#include "ui_updater_dialog.h"
|
#include "ui_updater_dialog.h"
|
||||||
|
|
||||||
@@ -8,6 +10,7 @@
|
|||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
#include <QDir>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
@@ -361,11 +364,29 @@ void UpdaterDialog::ShowCompletedState() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
#else
|
#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->titleLabel->setText(QStringLiteral("Update ready!"));
|
||||||
ui->statusLabel->setText(QStringLiteral("The update has been downloaded and prepared "
|
|
||||||
"successfully. The update will be applied when you "
|
QString status_message = QStringLiteral(
|
||||||
"restart Citron."));
|
"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->progressGroup->setVisible(false);
|
||||||
ui->downloadButton->setVisible(false);
|
ui->downloadButton->setVisible(false);
|
||||||
ui->cancelButton->setVisible(false);
|
ui->cancelButton->setVisible(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user