allow loading client args from config

This commit is contained in:
mxve 2023-09-14 10:32:03 +02:00
parent 73df20ebb6
commit 959c3a8a61
3 changed files with 8 additions and 4 deletions

View File

@ -23,6 +23,7 @@ pub fn save_value(config_path: PathBuf, key: &str, value: bool) {
"skip_self_update" => config.skip_self_update = value,
"download_bonus_content" => config.download_bonus_content = value,
"ask_bonus_content" => config.ask_bonus_content = value,
"force_update" => config.force_update = value,
_ => (),
}
save(config_path, config);

View File

@ -344,12 +344,13 @@ fn main() {
arg_remove(&mut args, "-f");
}
let client_args: String;
if let Some(pass) = arg_value(&args, "--pass") {
client_args = pass;
cfg.args = pass;
arg_remove_value(&mut args, "--pass");
} else {
client_args = String::new();
if cfg.args.is_empty() {
cfg.args = String::from("");
}
}
let games_json = http::get_body_string(format!("{}/games.json", MASTER).as_str());
@ -413,7 +414,7 @@ fn main() {
cfg.force_update,
);
if !cfg.update_only {
launch(&install_path.join(format!("{}.exe", c)), &client_args);
launch(&install_path.join(format!("{}.exe", c)), &cfg.args);
}
return;
}

View File

@ -21,6 +21,7 @@ pub struct Config {
pub download_bonus_content: bool,
pub ask_bonus_content: bool,
pub force_update: bool,
pub args: String,
}
impl Default for Config {
@ -31,6 +32,7 @@ impl Default for Config {
download_bonus_content: false,
ask_bonus_content: true,
force_update: false,
args: String::from(""),
}
}
}