1
Fork 0
mirror of https://github.com/redstrate/LauncherTweaks.git synced 2025-05-22 12:07:46 +00:00
LauncherTweaks/src/config.rs
Joshua Goins f17c70d3ac Add option to disable WebView2 install and boot version checks
These use terribly made function sigs but do work. WebView2 keeps
failing to install, so this is actuallt quite useful for me.
2025-04-22 15:45:08 -04:00

29 lines
787 B
Rust

use serde::Deserialize;
#[derive(Deserialize, Default)]
pub struct Config {
pub launcher_url: Option<String>,
pub winhttp_proxy: Option<String>,
#[serde(default = "Config::default_disable_webview2_install")]
pub disable_webview2_install: bool,
#[serde(default = "Config::default_disable_boot_version_check")]
pub disable_boot_version_check: bool,
}
impl Config {
fn default_disable_webview2_install() -> bool {
false
}
fn default_disable_boot_version_check() -> bool {
false
}
}
pub fn get_config() -> Config {
std::env::current_exe()
.ok()
.and_then(|p| std::fs::read_to_string(p.join("../launchertweaks.toml")).ok())
.and_then(|s| toml::from_str::<Config>(&s).ok())
.unwrap_or_default()
}