mirror of
https://github.com/alterware/alterware-launcher.git
synced 2025-12-04 07:17:50 +00:00
add --prerelease
This commit is contained in:
12
src/iw4x.rs
12
src/iw4x.rs
@@ -7,8 +7,8 @@ use crate::structs;
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
pub async fn remote_revision() -> u16 {
|
||||
match github::latest_tag(GH_IW4X_OWNER, GH_IW4X_REPO).await {
|
||||
pub async fn remote_revision(prerelease: Option<bool>) -> u16 {
|
||||
match github::latest_tag(GH_IW4X_OWNER, GH_IW4X_REPO, prerelease).await {
|
||||
Ok(tag) => misc::rev_to_int(&tag),
|
||||
Err(_) => {
|
||||
crate::println_error!("Failed to get latest version for {GH_IW4X_OWNER}/{GH_IW4X_REPO}, assuming we are up to date.");
|
||||
@@ -17,8 +17,8 @@ pub async fn remote_revision() -> u16 {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn update(dir: &Path, cache: &mut structs::Cache) {
|
||||
let remote = remote_revision().await;
|
||||
pub async fn update(dir: &Path, cache: &mut structs::Cache, prerelease: Option<bool>) {
|
||||
let remote = remote_revision(prerelease).await;
|
||||
let local = misc::rev_to_int(&cache.iw4x_revision);
|
||||
|
||||
if remote <= local && dir.join("iw4x.dll").exists() {
|
||||
@@ -34,8 +34,8 @@ pub async fn update(dir: &Path, cache: &mut structs::Cache) {
|
||||
);
|
||||
http_async::download_file(
|
||||
&format!(
|
||||
"{}/download/iw4x.dll",
|
||||
github::latest_release_url(GH_IW4X_OWNER, GH_IW4X_REPO)
|
||||
"{}/iw4x.dll",
|
||||
github::download_url(GH_IW4X_OWNER, GH_IW4X_REPO, Some(&format!("r{remote}")))
|
||||
),
|
||||
&dir.join("iw4x.dll"),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user