Browse Source

Look for legacy update directory for 1.2.0 -> 2.x.x updates

pull/55/head
JT 1 year ago
parent
commit
34af6c24bb
  1. 23
      StabilityMatrix.Avalonia/Program.cs

23
StabilityMatrix.Avalonia/Program.cs

@ -70,9 +70,13 @@ public class Program
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 @@ public class Program
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()

Loading…
Cancel
Save