From 9a90d8935acb33fcb2a05e2e648c7cb8341357be Mon Sep 17 00:00:00 2001 From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com> Date: Tue, 11 Mar 2025 22:15:46 +0000 Subject: [PATCH] ability to disable package cleanup --- Bloxstrap/Bootstrapper.cs | 25 +++++++++++++----------- Bloxstrap/Models/Persistable/Settings.cs | 1 + 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 3bf0cff..db84862 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -930,20 +930,23 @@ namespace Bloxstrap allPackageHashes.AddRange(App.State.Prop.Player.PackageHashes.Values); allPackageHashes.AddRange(App.State.Prop.Studio.PackageHashes.Values); - foreach (string hash in cachedPackageHashes) + if (!App.Settings.Prop.DebugDisableVersionPackageCleanup) { - if (!allPackageHashes.Contains(hash)) + foreach (string hash in cachedPackageHashes) { - App.Logger.WriteLine(LOG_IDENT, $"Deleting unused package {hash}"); - - try + if (!allPackageHashes.Contains(hash)) { - File.Delete(Path.Combine(Paths.Downloads, hash)); - } - catch (Exception ex) - { - App.Logger.WriteLine(LOG_IDENT, $"Failed to delete {hash}!"); - App.Logger.WriteException(LOG_IDENT, ex); + App.Logger.WriteLine(LOG_IDENT, $"Deleting unused package {hash}"); + + try + { + File.Delete(Path.Combine(Paths.Downloads, hash)); + } + catch (Exception ex) + { + App.Logger.WriteLine(LOG_IDENT, $"Failed to delete {hash}!"); + App.Logger.WriteException(LOG_IDENT, ex); + } } } } diff --git a/Bloxstrap/Models/Persistable/Settings.cs b/Bloxstrap/Models/Persistable/Settings.cs index a239f31..7523cb3 100644 --- a/Bloxstrap/Models/Persistable/Settings.cs +++ b/Bloxstrap/Models/Persistable/Settings.cs @@ -17,6 +17,7 @@ namespace Bloxstrap.Models.Persistable public bool UseFastFlagManager { get; set; } = true; public bool WPFSoftwareRender { get; set; } = false; public bool EnableAnalytics { get; set; } = true; + public bool DebugDisableVersionPackageCleanup { get; set; } = false; public string? SelectedCustomTheme { get; set; } = null; // integration configuration