aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/migration_worker.cpp
diff options
context:
space:
mode:
authorcrueter <swurl@swurl.xyz>2025-06-11 22:57:13 +0000
committercrueter <crueter@noreply.localhost>2025-06-11 22:57:13 +0000
commitc4ca8d2367e3283e2adcc37833376d68b2ece6fc (patch)
tree88d9dc9a3a112ac4fb2ad2f6854515e9b7e97ebc /src/yuzu/migration_worker.cpp
parent8ff1b9d282a9a7a8a02df86eecf19dbbd8440557 (diff)
Properly migrate internal NAND, Load, etc. directories (#167)
Signed-off-by: crueter <swurl@swurl.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/167 Co-authored-by: crueter <swurl@swurl.xyz> Co-committed-by: crueter <swurl@swurl.xyz>
Diffstat (limited to 'src/yuzu/migration_worker.cpp')
-rw-r--r--src/yuzu/migration_worker.cpp37
1 files changed, 11 insertions, 26 deletions
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 <QMap>
+#include <boost/algorithm/string/predicate.hpp>
+#include <boost/algorithm/string/replace.hpp>
#include <filesystem>
#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);
}