allow loading client args from config
This commit is contained in:
parent
a1004405ca
commit
d47ebbcb28
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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(""),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user