aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/migration_worker.cpp
diff options
context:
space:
mode:
authorcrueter <crueter@eden-emu.dev>2025-11-09 18:07:38 +0100
committercrueter <crueter@eden-emu.dev>2025-11-09 18:07:38 +0100
commit08f3639c80f188a3efd7ed1277b0bf8baaa33681 (patch)
tree800e528a84e5bd2e905c1f1fed69bd460475021b /src/yuzu/migration_worker.cpp
parente13c7ef3f80f04e710a9c620d7ec44dd37110b59 (diff)
[desktop, fs] main_window separation; fix Ryujinx save data link issues (#2929)
Some genius decided to put the entire MainWindow class into main.h and main.cpp, which is not only horrific practice but also completely destroys clangd beyond repair. Please, just don't do this. (this will probably merge conflict to hell and back) Also, fixes a bunch of issues with Ryujinx save data link: - Paths with spaces would cause mklink to fail - Add support for portable directories - Symlink detection was incorrect sometimes(????) - Some other stuff I'm forgetting Furthermore, when selecting "From Eden" and attempting to save in Ryujinx, Ryujinx would destroy the link for... some reason? So to get around this we just copy the Eden data to Ryujinx then treat it like a "From Ryujinx" op Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2929 Reviewed-by: Lizzie <lizzie@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Diffstat (limited to 'src/yuzu/migration_worker.cpp')
-rw-r--r--src/yuzu/migration_worker.cpp37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/yuzu/migration_worker.cpp b/src/yuzu/migration_worker.cpp
index 50b6d1ebd4..0149db4149 100644
--- a/src/yuzu/migration_worker.cpp
+++ b/src/yuzu/migration_worker.cpp
@@ -11,11 +11,11 @@
#include "common/fs/path_util.h"
-MigrationWorker::MigrationWorker(const Emulator selected_legacy_emu_,
+MigrationWorker::MigrationWorker(const Emulator selected_emu_,
const bool clear_shader_cache_,
const MigrationStrategy strategy_)
: QObject()
- , selected_legacy_emu(selected_legacy_emu_)
+ , selected_emu(selected_emu_)
, clear_shader_cache(clear_shader_cache_)
, strategy(strategy_)
{}
@@ -25,15 +25,20 @@ void MigrationWorker::process()
namespace fs = std::filesystem;
constexpr auto copy_options = fs::copy_options::update_existing | fs::copy_options::recursive;
- const fs::path legacy_user_dir = selected_legacy_emu.get_user_dir();
- const fs::path legacy_config_dir = selected_legacy_emu.get_config_dir();
- const fs::path legacy_cache_dir = selected_legacy_emu.get_cache_dir();
+ const fs::path legacy_user_dir = selected_emu.get_user_dir();
+ const fs::path legacy_config_dir = selected_emu.get_config_dir();
+ const fs::path legacy_cache_dir = selected_emu.get_cache_dir();
// TODO(crueter): Make these constexpr since they're defaulted
- const fs::path eden_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::EdenDir);
- const fs::path config_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::ConfigDir);
- const fs::path cache_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::CacheDir);
- const fs::path shader_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::ShaderDir);
+ 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 shader_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::ShaderDir);
+
+ eden_dir.make_preferred();
+ config_dir.make_preferred();
+ cache_dir.make_preferred();
+ shader_dir.make_preferred();
try {
fs::remove_all(eden_dir);
@@ -55,8 +60,8 @@ void MigrationWorker::process()
std::exit(-1);
}
-// Windows doesn't need any more links, because cache and config
-// are already children of the root directory
+ // Windows doesn't need any more links, because cache and config
+ // are already children of the root directory
#ifndef WIN32
if (fs::is_directory(legacy_config_dir)) {
Common::FS::CreateSymlink(legacy_config_dir, config_dir);
@@ -69,7 +74,7 @@ void MigrationWorker::process()
success_text.append(tr("\n\nNote that your configuration and data will be shared with %1.\n"
"If this is not desirable, delete the following files:\n%2\n%3\n%4")
- .arg(selected_legacy_emu.name(),
+ .arg(selected_emu.name(),
QString::fromStdString(eden_dir.string()),
QString::fromStdString(config_dir.string()),
QString::fromStdString(cache_dir.string())));
@@ -79,8 +84,8 @@ void MigrationWorker::process()
// Rename directories if deletion is requested (achieves the same result)
fs::rename(legacy_user_dir, eden_dir);
-// Windows doesn't need any more renames, because cache and config
-// are already children of the root directory
+ // Windows doesn't need any more renames, because cache and config
+ // are already children of the root directory
#ifndef WIN32
if (fs::is_directory(legacy_config_dir)) {
fs::rename(legacy_config_dir, config_dir);
@@ -96,8 +101,8 @@ void MigrationWorker::process()
// Default behavior: copy
fs::copy(legacy_user_dir, eden_dir, copy_options);
-// Windows doesn't need any more copies, because cache and config
-// are already children of the root directory
+ // Windows doesn't need any more copies, because cache and config
+ // are already children of the root directory
#ifndef WIN32
if (fs::is_directory(legacy_config_dir)) {
fs::copy(legacy_config_dir, config_dir, copy_options);