From cee3c8ad31c96d0e514decafcd16ac89b6b646a3 Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Fri, 7 Mar 2025 14:16:11 +0000 Subject: [PATCH] qt: Check for migration before qt-config.ini is created --- src/citra_qt/citra_qt.cpp | 12 ++++++------ src/citra_qt/citra_qt.h | 6 +++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/citra_qt/citra_qt.cpp b/src/citra_qt/citra_qt.cpp index e0aa9e80d..ae71b8741 100644 --- a/src/citra_qt/citra_qt.cpp +++ b/src/citra_qt/citra_qt.cpp @@ -167,6 +167,8 @@ void GMainWindow::ShowCommandOutput(std::string title, std::string message) { GMainWindow::GMainWindow(Core::System& system_) : ui{std::make_unique()}, system{system_}, movie{system.Movie()}, + emu_dir_exists{ + std::filesystem::is_directory(FileUtil::GetUserPath(FileUtil::UserPath::UserDir))}, config{std::make_unique()}, emu_thread{nullptr} { Common::Log::Initialize(); Common::Log::Start(); @@ -308,7 +310,9 @@ GMainWindow::GMainWindow(Core::System& system_) } // Check if data migration from Citra/Lime3DS needs to be performed - CheckForMigration(); + if (!emu_dir_exists) { + ShowMigrationPrompt(); + } #ifdef __unix__ SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue()); @@ -1218,13 +1222,9 @@ void GMainWindow::ShowMigrationCancelledMessage() { QMessageBox::Ok); } -void GMainWindow::CheckForMigration() { +void GMainWindow::ShowMigrationPrompt() { namespace fs = std::filesystem; - if (fs::is_directory(FileUtil::GetUserPath(FileUtil::UserPath::UserDir))) { - return; - } - const QString migration_prompt_message = tr("Would you like to migrate your data for use in Azahar?\n" "(This may take a while; The old data will not be deleted)"); diff --git a/src/citra_qt/citra_qt.h b/src/citra_qt/citra_qt.h index ad8cdcf91..b2e98ad22 100644 --- a/src/citra_qt/citra_qt.h +++ b/src/citra_qt/citra_qt.h @@ -178,7 +178,7 @@ private: Lime3DS, }; void ShowMigrationCancelledMessage(); - void CheckForMigration(); + void ShowMigrationPrompt(); void MigrateUserData(const LegacyEmu selected_legacy_emu); /** @@ -357,6 +357,10 @@ private: bool message_label_used_for_movie = false; MultiplayerState* multiplayer_state = nullptr; + + // Created before `config` to ensure that emu data directory + // isn't created before the check is performed + bool emu_dir_exists; std::unique_ptr config; // Whether emulation is currently running in Citra.