diff --git a/src/Ryujinx.Ava/Modules/Updater/Updater.cs b/src/Ryujinx.Ava/Modules/Updater/Updater.cs index 77d77d79..839526c4 100644 --- a/src/Ryujinx.Ava/Modules/Updater/Updater.cs +++ b/src/Ryujinx.Ava/Modules/Updater/Updater.cs @@ -740,6 +740,18 @@ namespace Ryujinx.Modules { var files = Directory.EnumerateFiles(HomeDir); // All files directly in base dir. + // Determine and exclude user files only when the updater is running, not when cleaning old files + if (_running) + { + // Compare the loose files in base directory against the loose files from the incoming update, and store foreign ones in a user list. + var oldFiles = Directory.EnumerateFiles(HomeDir, "*", SearchOption.TopDirectoryOnly).Select(Path.GetFileName); + var newFiles = Directory.EnumerateFiles(UpdatePublishDir, "*", SearchOption.TopDirectoryOnly).Select(Path.GetFileName); + var userFiles = oldFiles.Except(newFiles).Select(filename => Path.Combine(HomeDir, filename)); + + // Remove user files from the paths in files. + files = files.Except(userFiles); + } + if (OperatingSystem.IsWindows()) { foreach (string dir in WindowsDependencyDirs) diff --git a/src/Ryujinx/Modules/Updater/Updater.cs b/src/Ryujinx/Modules/Updater/Updater.cs index 3e0dc99b..344edf9e 100644 --- a/src/Ryujinx/Modules/Updater/Updater.cs +++ b/src/Ryujinx/Modules/Updater/Updater.cs @@ -565,6 +565,18 @@ namespace Ryujinx.Modules { var files = Directory.EnumerateFiles(HomeDir); // All files directly in base dir. + // Determine and exclude user files only when the updater is running, not when cleaning old files + if (Running) + { + // Compare the loose files in base directory against the loose files from the incoming update, and store foreign ones in a user list. + var oldFiles = Directory.EnumerateFiles(HomeDir, "*", SearchOption.TopDirectoryOnly).Select(Path.GetFileName); + var newFiles = Directory.EnumerateFiles(UpdatePublishDir, "*", SearchOption.TopDirectoryOnly).Select(Path.GetFileName); + var userFiles = oldFiles.Except(newFiles).Select(filename => Path.Combine(HomeDir, filename)); + + // Remove user files from the paths in files. + files = files.Except(userFiles); + } + if (OperatingSystem.IsWindows()) { foreach (string dir in WindowsDependencyDirs)