From f0286a418ec73d94c0e9fe8c983b4ec2baa64bbc Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Fri, 24 Mar 2023 15:55:23 +0200 Subject: [PATCH] fix: fixed infinite retries to download some update or patch the game if it failed --- CHANGELOG.md | 1 + src/ui/main/apply_patch.rs | 8 +++++++- src/ui/main/download_diff.rs | 8 +++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 792fe6c..4d603e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed downloaded wine version selection on "download wine" button - Fixed game downloading (it wasn't working since some version????) +- Fixed infinite retries to download some update or patch the game if it failed ### Removed diff --git a/src/ui/main/apply_patch.rs b/src/ui/main/apply_patch.rs index bc26327..6cecf8c 100644 --- a/src/ui/main/apply_patch.rs +++ b/src/ui/main/apply_patch.rs @@ -19,6 +19,8 @@ pub fn apply_patch(sender: ComponentSender< let config = config::get().unwrap(); std::thread::spawn(move || { + let mut apply_patch_if_needed = true; + if let Err(err) = patch.apply(&config.game.path, config.patch.root) { tracing::error!("Failed to patch the game"); @@ -26,12 +28,16 @@ pub fn apply_patch(sender: ComponentSender< title: tr("game-patching-error"), description: Some(err.to_string()) }); + + // Don't try to apply the patch after state updating + // because we just failed to do it + apply_patch_if_needed = false; } sender.input(AppMsg::DisableButtons(false)); sender.input(AppMsg::UpdateLauncherState { perform_on_download_needed: false, - apply_patch_if_needed: true, + apply_patch_if_needed, show_status_page: true }); }); diff --git a/src/ui/main/download_diff.rs b/src/ui/main/download_diff.rs index ef8c719..5aa8859 100644 --- a/src/ui/main/download_diff.rs +++ b/src/ui/main/download_diff.rs @@ -46,6 +46,8 @@ pub fn download_diff(sender: ComponentSender, progress_bar_input: Sender, progress_bar_input: Sender