fix(ui): fixed repairer's NaN progress

This commit is contained in:
Observer KRypt0n_ 2023-06-12 15:45:30 +02:00
parent 85fd0aed14
commit 5557c31895
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2

View file

@ -98,14 +98,14 @@ pub fn repair_game(sender: ComponentSender<App>, progress_bar_input: Sender<Prog
}
if !broken.is_empty() {
let total = broken.len() as u64;
progress_bar_input.send(ProgressBarMsg::UpdateCaption(Some(tr("repairing-files"))));
progress_bar_input.send(ProgressBarMsg::DisplayFraction(false));
progress_bar_input.send(ProgressBarMsg::UpdateProgress(0, 0));
progress_bar_input.send(ProgressBarMsg::UpdateProgress(0, total));
tracing::warn!("Found broken files:\n{}", broken.iter().fold(String::new(), |acc, file| acc + &format!("- {}\n", file.path.to_string_lossy())));
let total = broken.len() as f64;
// Get main patch status
let player_patch = UnityPlayerPatch::from_folder(&config.patch.path, config.launcher.edition)
@ -175,7 +175,7 @@ pub fn repair_game(sender: ComponentSender<App>, progress_bar_input: Sender<Prog
tracing::debug!("Skipped file: {}", file.path.to_string_lossy());
}
progress_bar_input.send(ProgressBarMsg::UpdateProgress(i as u64, total as u64));
progress_bar_input.send(ProgressBarMsg::UpdateProgress(i as u64 + 1, total));
}
progress_bar_input.send(ProgressBarMsg::DisplayFraction(true));