From 34af6c24bbb05ac7e5f407456f149d5f5816d5ac Mon Sep 17 00:00:00 2001 From: JT Date: Mon, 24 Jul 2023 18:31:08 -0700 Subject: [PATCH 1/2] Look for legacy update directory for 1.2.0 -> 2.x.x updates --- StabilityMatrix.Avalonia/Program.cs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/StabilityMatrix.Avalonia/Program.cs b/StabilityMatrix.Avalonia/Program.cs index 5d614db1c..ab0ef9603 100644 --- a/StabilityMatrix.Avalonia/Program.cs +++ b/StabilityMatrix.Avalonia/Program.cs @@ -70,9 +70,13 @@ public static AppBuilder BuildAvaloniaApp() private static void HandleUpdateReplacement() { - // Check if we're in the named update folder - if (Compat.AppCurrentDir.Parent is {Name: UpdateHelper.UpdateFolderName} parentDir) + // Check if we're in the named update folder or the legacy update folder for 1.2.0 -> 2.0.0 + if (Compat.AppCurrentDir is {Name: UpdateHelper.UpdateFolderName} or {Name: "Update"}) { + var parentDir = Compat.AppCurrentDir.Parent; + if (parentDir is null) + return; + var retryDelays = Backoff.DecorrelatedJitterBackoffV2( TimeSpan.FromMilliseconds(350), retryCount: 5); @@ -112,6 +116,21 @@ private static void HandleUpdateReplacement() logger.Error(e, "Failed to delete update file"); } } + + // for 1.2.0 -> 2.0.0 update + var legacyUpdateDir = Compat.AppCurrentDir.JoinDir("Update"); + if (legacyUpdateDir.Exists) + { + try + { + legacyUpdateDir.Delete(true); + } + catch (Exception e) + { + var logger = LogManager.GetCurrentClassLogger(); + logger.Error(e, "Failed to delete legacy update file"); + } + } } private static void ConfigureSentry() From f6a9cbf01c5b84f0a99401dd9696a715350a40e8 Mon Sep 17 00:00:00 2001 From: JT Date: Mon, 24 Jul 2023 18:34:45 -0700 Subject: [PATCH 2/2] don't delete legacy update folder --- StabilityMatrix.Avalonia/Program.cs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/StabilityMatrix.Avalonia/Program.cs b/StabilityMatrix.Avalonia/Program.cs index ab0ef9603..da0bcacab 100644 --- a/StabilityMatrix.Avalonia/Program.cs +++ b/StabilityMatrix.Avalonia/Program.cs @@ -116,21 +116,6 @@ private static void HandleUpdateReplacement() logger.Error(e, "Failed to delete update file"); } } - - // for 1.2.0 -> 2.0.0 update - var legacyUpdateDir = Compat.AppCurrentDir.JoinDir("Update"); - if (legacyUpdateDir.Exists) - { - try - { - legacyUpdateDir.Delete(true); - } - catch (Exception e) - { - var logger = LogManager.GetCurrentClassLogger(); - logger.Error(e, "Failed to delete legacy update file"); - } - } } private static void ConfigureSentry()