download bonus content

This commit is contained in:
2023-09-10 18:29:30 +02:00
parent 86b0bb1b7a
commit 349efa4e43
4 changed files with 72 additions and 23 deletions

View File

@@ -15,3 +15,15 @@ pub fn load(config_path: PathBuf) -> Config {
pub fn save(config_path: PathBuf, config: Config) {
fs::write(config_path, serde_json::to_string(&config).unwrap()).unwrap();
}
pub fn save_value(config_path: PathBuf, key: &str, value: bool) {
let mut config = load(config_path.clone());
match key {
"update_only" => config.update_only = value,
"skip_self_update" => config.skip_self_update = value,
"download_bonus_content" => config.download_bonus_content = value,
"ask_bonus_content" => config.ask_bonus_content = value,
_ => (),
}
save(config_path, config);
}