automatically install dependencies

This commit is contained in:
2024-07-13 08:29:11 +02:00
parent f42738cfd9
commit 786621f9c0
6 changed files with 131 additions and 22 deletions

View File

@@ -167,28 +167,6 @@ async fn windows_launcher_install(games: &Vec<Game<'_>>, master_url: &String) {
}
}
// fn prompt_client_selection(games: &[Game]) -> String {
// println!(
// "Couldn't detect any games, please select a client to install in the current directory:"
// );
// for (i, g) in games.iter().enumerate() {
// for c in g.client.iter() {
// println!("{}: {}", i, c);
// }
// }
// let input: usize = misc::stdin().parse().unwrap();
// String::from(games[input].client[0])
// }
// async fn manual_install(games: &[Game<'_>]) {
// let selection = prompt_client_selection(games);
// let game = games.iter().find(|&g| g.client[0] == selection).unwrap();
// update(game, &env::current_dir().unwrap(), false, false).await;
// println!("Installation complete. Please run the launcher again or use a shortcut to launch the game.");
// std::io::stdin().read_line(&mut String::new()).unwrap();
// std::process::exit(0);
// }
fn total_download_size(cdn_info: &Vec<CdnFile>, remote_dir: &str) -> u64 {
let remote_dir = format!("{}/", remote_dir);
let mut size: u64 = 0;
@@ -598,6 +576,8 @@ async fn main() {
println!(" --pass <args>: Pass arguments to the game");
println!(" --skip-launcher-update: Skip launcher self-update");
println!(" --ignore-required-files: Skip required files check");
println!(" --skip-redist: Skip redistributable installation");
println!(" --redist: (Re-)Install redistributables");
println!(
"\nExample:\n alterware-launcher.exe iw4x --bonus --pass \"-console -nointro\""
);
@@ -679,6 +659,17 @@ async fn main() {
cfg.args = String::default();
}
if arg_bool(&args, "--skip-redist") {
cfg.skip_redist = true;
arg_remove(&mut args, "--skip-redist");
}
#[cfg(windows)]
if arg_bool(&args, "--redist") {
arg_remove(&mut args, "--redist");
misc::install_dependencies(&install_path).await;
}
let games_json = http_async::get_body_string(format!("{}/games.json", master_url).as_str())
.await
.unwrap();
@@ -738,6 +729,11 @@ async fn main() {
cfg.args.clone(),
);
}
#[cfg(windows)]
if !cfg.skip_redist {
misc::install_dependencies(&install_path).await;
}
}
if cfg.engine == "iw4" && !cfg.args.contains("+set logfile 1") {