mirror of
https://github.com/alterware/alterware-launcher.git
synced 2026-03-24 19:13:05 +00:00
@@ -36,6 +36,10 @@ pub async fn download_file_progress(
|
|||||||
format!("Failed to GET from '{url}'")
|
format!("Failed to GET from '{url}'")
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
if !res.status().is_success() {
|
||||||
|
return Err(format!("Request failed with status: {}", res.status()));
|
||||||
|
}
|
||||||
|
|
||||||
let total_size = res.content_length().unwrap_or(size);
|
let total_size = res.content_length().unwrap_or(size);
|
||||||
debug!("Download size: {}", misc::human_readable_bytes(total_size));
|
debug!("Download size: {}", misc::human_readable_bytes(total_size));
|
||||||
pb.set_length(total_size);
|
pb.set_length(total_size);
|
||||||
@@ -93,6 +97,10 @@ pub async fn get_body(url: &str) -> Result<Vec<u8>, String> {
|
|||||||
|
|
||||||
debug!("{} {url}", res.status());
|
debug!("{} {url}", res.status());
|
||||||
|
|
||||||
|
if !res.status().is_success() {
|
||||||
|
return Err(format!("Request failed with status: {}", res.status()));
|
||||||
|
}
|
||||||
|
|
||||||
res.bytes()
|
res.bytes()
|
||||||
.await
|
.await
|
||||||
.map(|b| b.to_vec())
|
.map(|b| b.to_vec())
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ pub async fn run(update_only: bool, prerelease: Option<bool>) {
|
|||||||
"alterware-launcher.exe"
|
"alterware-launcher.exe"
|
||||||
};
|
};
|
||||||
|
|
||||||
http_async::download_file(
|
if let Err(e) = http_async::download_file(
|
||||||
&format!(
|
&format!(
|
||||||
"{}/download/{}",
|
"{}/download/{}",
|
||||||
github::download_url(GH_OWNER, GH_REPO, None),
|
github::download_url(GH_OWNER, GH_REPO, None),
|
||||||
@@ -102,7 +102,11 @@ pub async fn run(update_only: bool, prerelease: Option<bool>) {
|
|||||||
&file_path,
|
&file_path,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
{
|
||||||
|
error!("Self-update download failed: {e}");
|
||||||
|
crate::println_error!("Self-update failed ({e}), skipping update.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if !file_path.exists() {
|
if !file_path.exists() {
|
||||||
crate::println_error!("Failed to download launcher update.");
|
crate::println_error!("Failed to download launcher update.");
|
||||||
|
|||||||
Reference in New Issue
Block a user