From 41ff4acd657fddce16b647fc04ef7116e4d69242 Mon Sep 17 00:00:00 2001 From: mxve <68632137+mxve@users.noreply.github.com> Date: Thu, 2 Nov 2023 11:44:08 +0100 Subject: [PATCH] update iw4x first so we don't have to pass the progressbar to iw4x just to not have it break by a little println --- src/iw4x.rs | 10 +++++++++- src/main.rs | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/iw4x.rs b/src/iw4x.rs index 7952504..982576d 100644 --- a/src/iw4x.rs +++ b/src/iw4x.rs @@ -23,13 +23,21 @@ pub fn update(dir: &Path) { let local = local_revision(dir); if remote <= local && dir.join("iw4x.dll").exists() { + println!( + "[{}] No files to download for IW4x", + "Info".bright_magenta(), + ); return; } + println!( + "[{}] Downloading outdated or missing files for IW4x", + "Info".bright_magenta() + ); println!( "[{}] {}", "Downloading".bright_yellow(), - dir.join("iw4x.dll").display() + misc::cute_path(&dir.join("iw4x.dll")) ); http::download_file( &format!( diff --git a/src/main.rs b/src/main.rs index 5d34da0..b02134a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -294,13 +294,13 @@ async fn update(game: &Game<'_>, dir: &Path, bonus_content: bool, force: bool) { } } - let pb = ProgressBar::new(0); - update_dir(&cdn_info, game.engine, dir, &mut hashes, &pb).await; - if game.engine == "iw4" { iw4x::update(dir); } + let pb = ProgressBar::new(0); + update_dir(&cdn_info, game.engine, dir, &mut hashes, &pb).await; + if bonus_content && !game.bonus.is_empty() { for bonus in game.bonus.iter() { update_dir(&cdn_info, bonus, dir, &mut hashes, &pb).await;