From a91742fe513c78b22790a23a2bcdac26f7153f34 Mon Sep 17 00:00:00 2001 From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com> Date: Fri, 27 Dec 2024 17:39:13 +0000 Subject: [PATCH] delete latest version directory if it exists before update --- Bloxstrap/Bootstrapper.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 7a7cfc7..aa71eff 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -706,6 +706,19 @@ namespace Bloxstrap _isInstalling = true; + if (Directory.Exists(_latestVersionDirectory)) + { + try + { + Directory.Delete(_latestVersionDirectory, true); + } + catch (Exception ex) + { + App.Logger.WriteLine(LOG_IDENT, "Failed to delete the latest version directory"); + App.Logger.WriteException(LOG_IDENT, ex); + } + } + Directory.CreateDirectory(_latestVersionDirectory); var cachedPackageHashes = Directory.GetFiles(Paths.Downloads).Select(x => Path.GetFileName(x));