From 46864afff5c5f362bae986b0762aeb1c0fe5ada2 Mon Sep 17 00:00:00 2001 From: Ruri Date: Mon, 1 Jul 2024 17:18:15 +0200 Subject: [PATCH] [build] 0.3.0 Fixed issue that would cause data loss when updating from 0.2.x --- OpenBullet2.Native.Updater/Helpers/FileSystemHelper.cs | 4 ++-- OpenBullet2.Web.Updater/Helpers/FileSystemHelper.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) 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; }