From c4ca8d2367e3283e2adcc37833376d68b2ece6fc Mon Sep 17 00:00:00 2001 From: crueter Date: Wed, 11 Jun 2025 22:57:13 +0000 Subject: Properly migrate internal NAND, Load, etc. directories (#167) Signed-off-by: crueter Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/167 Co-authored-by: crueter Co-committed-by: crueter --- src/yuzu/migration_worker.cpp | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) (limited to 'src/yuzu/migration_worker.cpp') diff --git a/src/yuzu/migration_worker.cpp b/src/yuzu/migration_worker.cpp index 2bb6eee944..bd96fec5de 100644 --- a/src/yuzu/migration_worker.cpp +++ b/src/yuzu/migration_worker.cpp @@ -1,10 +1,13 @@ #include "migration_worker.h" +#include +#include +#include #include #include "common/fs/path_util.h" -MigrationWorker::MigrationWorker(const LegacyEmu selected_legacy_emu_, +MigrationWorker::MigrationWorker(const Emulator selected_legacy_emu_, const bool clear_shader_cache_, const MigrationStrategy strategy_) : QObject() @@ -18,31 +21,13 @@ void MigrationWorker::process() namespace fs = std::filesystem; const auto copy_options = fs::copy_options::update_existing | fs::copy_options::recursive; - std::string legacy_user_dir; - std::string legacy_config_dir; - std::string legacy_cache_dir; - -#define LEGACY_EMU(emu) \ - case LegacyEmu::emu: \ - legacy_user_dir = Common::FS::GetLegacyPath(Common::FS::LegacyPath::emu##Dir).string(); \ - legacy_config_dir = Common::FS::GetLegacyPath(Common::FS::LegacyPath::emu##ConfigDir) \ - .string(); \ - legacy_cache_dir = Common::FS::GetLegacyPath(Common::FS::LegacyPath::emu##CacheDir) \ - .string(); \ - break; - - switch (selected_legacy_emu) { - LEGACY_EMU(Citron) - LEGACY_EMU(Sudachi) - LEGACY_EMU(Yuzu) - LEGACY_EMU(Suyu) - } - -#undef LEGACY_EMU + std::string legacy_user_dir = selected_legacy_emu.get_user_dir(); + std::string legacy_config_dir = selected_legacy_emu.get_config_dir(); + std::string legacy_cache_dir = selected_legacy_emu.get_cache_dir(); - fs::path eden_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::EdenDir); + fs::path eden_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::EdenDir); fs::path config_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::ConfigDir); - fs::path cache_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::CacheDir); + fs::path cache_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::CacheDir); fs::path shader_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::ShaderDir); try { @@ -62,7 +47,7 @@ void MigrationWorker::process() emit error(tr("Linking the old directory failed. You may need to re-run with " "administrative privileges on Windows.\nOS gave error: %1") .arg(tr(e.what()))); - return; + std::exit(-1); } // Windows doesn't need any more links, because cache and config @@ -119,5 +104,5 @@ void MigrationWorker::process() fs::create_directory(shader_dir); } - emit finished(success_text); + emit finished(success_text, legacy_user_dir); } -- cgit v1.2.3