mirror of
https://github.com/an-anime-team/sleepy-launcher.git
synced 2025-02-16 17:59:46 +03:00
fix: fixed infinite retries to download some update or patch the game if it failed
This commit is contained in:
parent
7c02c318ef
commit
f0286a418e
3 changed files with 15 additions and 2 deletions
|
@ -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 downloaded wine version selection on "download wine" button
|
||||||
- Fixed game downloading (it wasn't working since some version????)
|
- 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
|
### Removed
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@ pub fn apply_patch<T: PatchExt + Send + Sync + 'static>(sender: ComponentSender<
|
||||||
let config = config::get().unwrap();
|
let config = config::get().unwrap();
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
|
let mut apply_patch_if_needed = true;
|
||||||
|
|
||||||
if let Err(err) = patch.apply(&config.game.path, config.patch.root) {
|
if let Err(err) = patch.apply(&config.game.path, config.patch.root) {
|
||||||
tracing::error!("Failed to patch the game");
|
tracing::error!("Failed to patch the game");
|
||||||
|
|
||||||
|
@ -26,12 +28,16 @@ pub fn apply_patch<T: PatchExt + Send + Sync + 'static>(sender: ComponentSender<
|
||||||
title: tr("game-patching-error"),
|
title: tr("game-patching-error"),
|
||||||
description: Some(err.to_string())
|
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::DisableButtons(false));
|
||||||
sender.input(AppMsg::UpdateLauncherState {
|
sender.input(AppMsg::UpdateLauncherState {
|
||||||
perform_on_download_needed: false,
|
perform_on_download_needed: false,
|
||||||
apply_patch_if_needed: true,
|
apply_patch_if_needed,
|
||||||
show_status_page: true
|
show_status_page: true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -46,6 +46,8 @@ pub fn download_diff(sender: ComponentSender<App>, progress_bar_input: Sender<Pr
|
||||||
progress_bar_input.send(ProgressBarMsg::UpdateFromState(state));
|
progress_bar_input.send(ProgressBarMsg::UpdateFromState(state));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
let mut perform_on_download_needed = true;
|
||||||
|
|
||||||
if let Err(err) = result {
|
if let Err(err) = result {
|
||||||
tracing::error!("Downloading failed: {err}");
|
tracing::error!("Downloading failed: {err}");
|
||||||
|
|
||||||
|
@ -53,11 +55,15 @@ pub fn download_diff(sender: ComponentSender<App>, progress_bar_input: Sender<Pr
|
||||||
title: tr("downloading-failed"),
|
title: tr("downloading-failed"),
|
||||||
description: Some(err.to_string())
|
description: Some(err.to_string())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Don't try to download something after state updating
|
||||||
|
// because we just failed to do it
|
||||||
|
perform_on_download_needed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.input(AppMsg::SetDownloading(false));
|
sender.input(AppMsg::SetDownloading(false));
|
||||||
sender.input(AppMsg::UpdateLauncherState {
|
sender.input(AppMsg::UpdateLauncherState {
|
||||||
perform_on_download_needed: true,
|
perform_on_download_needed,
|
||||||
apply_patch_if_needed: false,
|
apply_patch_if_needed: false,
|
||||||
show_status_page: false
|
show_status_page: false
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue