mirror of
https://github.com/alterware/alterware-launcher.git
synced 2025-12-04 07:17:50 +00:00
Added loop for retrying failed downloads
This commit is contained in:
33
src/main.rs
33
src/main.rs
@@ -258,17 +258,28 @@ async fn update_dir(
|
|||||||
fs::create_dir_all(parent).unwrap();
|
fs::create_dir_all(parent).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Err(err) = http_async::download_file_progress(
|
|
||||||
&client,
|
// Prompt user to retry downloads if they fail
|
||||||
pb,
|
let mut download_complete : bool = false;
|
||||||
&format!("{}/{}", master_url, file.name),
|
while !download_complete {
|
||||||
&file_path,
|
if let Err(err) = http_async::download_file_progress(
|
||||||
file.size as u64,
|
&client,
|
||||||
)
|
pb,
|
||||||
.await
|
&format!("{}/{}", master_url, file.name),
|
||||||
{
|
&file_path,
|
||||||
panic!("{err}");
|
file.size as u64,
|
||||||
};
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
println!("Failed to download file {}, retry? (Y/n)", file_path.clone().display());
|
||||||
|
let input = misc::stdin().to_ascii_lowercase();
|
||||||
|
if input == "n" {
|
||||||
|
panic!("{err}");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
download_complete = true;
|
||||||
|
}
|
||||||
|
|
||||||
let hash = misc::file_blake3(&file_path).unwrap();
|
let hash = misc::file_blake3(&file_path).unwrap();
|
||||||
hashes.insert(file_name.to_owned(), hash.to_lowercase());
|
hashes.insert(file_name.to_owned(), hash.to_lowercase());
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
|
|||||||
Reference in New Issue
Block a user