From 6c7c63e39f1bcd3f76c0902e1df4e54f335205cd Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Thu, 6 May 2021 10:56:52 -0700 Subject: [PATCH] Add an updater flag to just download updates without removing extra files --- updater/src/main.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/updater/src/main.rs b/updater/src/main.rs index 583aa28bb8..cf3202aa76 100644 --- a/updater/src/main.rs +++ b/updater/src/main.rs @@ -40,20 +40,24 @@ async fn main() { opt_into_all(); } else { let minimal = args.enabled("--minimal"); + // If true, only update files from the manifest. Leave extra files alone. + let dont_delete = args.enabled("--dont_delete"); args.done(); - download_updates(version, minimal).await; + download_updates(version, minimal, !dont_delete).await; } } -async fn download_updates(version: String, minimal: bool) { +async fn download_updates(version: String, minimal: bool, delete_local: bool) { let data_packs = DataPacks::load_or_create(); let truth = Manifest::load().filter(data_packs); let local = generate_manifest(&truth); // Anything local need deleting? - for path in local.entries.keys() { - if !truth.entries.contains_key(path) { - rm(&path); + if delete_local { + for path in local.entries.keys() { + if !truth.entries.contains_key(path) { + rm(&path); + } } }