feat: added wine/dxvk downloading skipping in initial setup

This can cause some issues and in general is a good idea to
avoid downloading what is already downloaded
This commit is contained in:
Observer KRypt0n_ 2023-03-11 09:41:28 +02:00
parent b4f205b885
commit 942abd8474
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2

View file

@ -345,8 +345,17 @@ impl SimpleAsyncComponent for DownloadComponentsApp {
let wine = self.selected_wine.clone().unwrap();
let progress_bar_input = self.progress_bar.sender().clone();
// Skip wine downloading if it was already done
if wine.is_downloaded_in(&config.game.wine.builds) {
tracing::info!("Wine already installed: {}", wine.name);
sender.input(DownloadComponentsAppMsg::CreatePrefix);
}
// Otherwise download wine
else {
std::thread::spawn(move || {
tracing::info!("Installing wine");
tracing::info!("Installing wine: {}", wine.name);
// Install wine
match get_installer(&wine.uri, config.launcher.temp.as_ref(), config.launcher.speed_limit) {
@ -411,6 +420,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp {
}
});
}
}
#[allow(unused_must_use)]
DownloadComponentsAppMsg::CreatePrefix => {
@ -455,9 +465,16 @@ impl SimpleAsyncComponent for DownloadComponentsApp {
let dxvk = self.selected_dxvk.clone().unwrap();
let progress_bar_input = self.progress_bar.sender().clone();
if dxvk.is_downloaded_in(&config.game.dxvk.builds) {
tracing::info!("DXVK is already downloaded: {}", dxvk.name);
sender.input(DownloadComponentsAppMsg::ApplyDXVK);
}
else {
std::thread::spawn(move || {
// Install DXVK
tracing::info!("Installing DXVK");
tracing::info!("Installing DXVK: {}", dxvk.name);
match get_installer(&dxvk.uri, config.launcher.temp.as_ref(), config.launcher.speed_limit) {
Ok(mut installer) => {
@ -513,6 +530,7 @@ impl SimpleAsyncComponent for DownloadComponentsApp {
}
});
}
}
#[allow(unused_must_use)]
DownloadComponentsAppMsg::ApplyDXVK => {