From baf8752e74488a419074ae1d484e54a00bc01973 Mon Sep 17 00:00:00 2001
From: Vincenzo Nizza <vincenzonizzaufficio@gmail.com>
Date: Sun, 16 Apr 2023 11:19:33 +0200
Subject: [PATCH] Ensure the updater doesn't delete hidden or system files
 (#4626)

* Copy desktop.ini to update directory if it exists in HomeDir

* EnumerateFilesToDelete() exclude files with "Hidden" and "System" attributes
---
 Ryujinx.Ava/Modules/Updater/Updater.cs | 2 +-
 Ryujinx/Modules/Updater/Updater.cs     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Ryujinx.Ava/Modules/Updater/Updater.cs b/Ryujinx.Ava/Modules/Updater/Updater.cs
index c5857528..05429935 100644
--- a/Ryujinx.Ava/Modules/Updater/Updater.cs
+++ b/Ryujinx.Ava/Modules/Updater/Updater.cs
@@ -730,7 +730,7 @@ namespace Ryujinx.Modules
                 }
             }
 
-            return files;
+            return files.Where(f => !new FileInfo(f).Attributes.HasFlag(FileAttributes.Hidden | FileAttributes.System));
         }
 
         private static void MoveAllFilesOver(string root, string dest, TaskDialog taskDialog)
diff --git a/Ryujinx/Modules/Updater/Updater.cs b/Ryujinx/Modules/Updater/Updater.cs
index 3f186ce6..3e0dc99b 100644
--- a/Ryujinx/Modules/Updater/Updater.cs
+++ b/Ryujinx/Modules/Updater/Updater.cs
@@ -577,7 +577,7 @@ namespace Ryujinx.Modules
                 }
             }
 
-            return files;
+            return files.Where(f => !new FileInfo(f).Attributes.HasFlag(FileAttributes.Hidden | FileAttributes.System));
         }
 
         private static void MoveAllFilesOver(string root, string dest, UpdateDialog dialog)