diff --git a/OpenBullet2.Native.Updater/Helpers/FileSystemHelper.cs b/OpenBullet2.Native.Updater/Helpers/FileSystemHelper.cs index e560feb3c..1f2f05901 100644 --- a/OpenBullet2.Native.Updater/Helpers/FileSystemHelper.cs +++ b/OpenBullet2.Native.Updater/Helpers/FileSystemHelper.cs @@ -86,8 +86,8 @@ public static async Task CleanupInstallationFolderAsync() { var isDirectory = (File.GetAttributes(entry) & FileAttributes.Directory) == FileAttributes.Directory; - // If it's appsettings.json or the UserData folder, disregard it - if (entry == "appsettings.json" || entry.StartsWith("UserData")) + // If it even contains appsettings.json or UserData, disregard it (prevent accidental deletion) + if (entry.Contains("appsettings.json") || entry.Contains("UserData")) { continue; } diff --git a/OpenBullet2.Web.Updater/Helpers/FileSystemHelper.cs b/OpenBullet2.Web.Updater/Helpers/FileSystemHelper.cs index a0718a767..983ebedf7 100644 --- a/OpenBullet2.Web.Updater/Helpers/FileSystemHelper.cs +++ b/OpenBullet2.Web.Updater/Helpers/FileSystemHelper.cs @@ -85,9 +85,9 @@ public static async Task CleanupInstallationFolderAsync() foreach (var entry in Directory.EnumerateFileSystemEntries(Directory.GetCurrentDirectory())) { var isDirectory = (File.GetAttributes(entry) & FileAttributes.Directory) == FileAttributes.Directory; - - // If it's appsettings.json or the UserData folder, disregard it - if (entry == "appsettings.json" || entry.StartsWith("UserData")) + + // If it even contains appsettings.json or UserData, disregard it (prevent accidental deletion) + if (entry.Contains("appsettings.json") || entry.Contains("UserData")) { continue; }