mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-14 08:04:52 +01:00
arg update fixes
This commit is contained in:
@@ -2,29 +2,30 @@ use serde::{Deserialize, Serialize};
|
||||
use std::path::PathBuf;
|
||||
use std::string::String;
|
||||
|
||||
// Config may not exist, or may be old, so it's okay if these are optional
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct Configuration {
|
||||
pub toggle_grasscutter: bool,
|
||||
pub game_install_path: String,
|
||||
pub grasscutter_with_game: bool,
|
||||
pub grasscutter_path: String,
|
||||
pub java_path: String,
|
||||
pub close_action: u64,
|
||||
pub startup_launch: bool,
|
||||
pub last_ip: String,
|
||||
pub last_port: String,
|
||||
pub language: String,
|
||||
pub customBackground: String,
|
||||
pub cert_generated: bool,
|
||||
pub theme: String,
|
||||
pub https_enabled: bool,
|
||||
pub debug_enabled: bool,
|
||||
pub patch_rsa: bool,
|
||||
pub use_internal_proxy: bool,
|
||||
pub wipe_login: bool,
|
||||
pub horny_mode: bool,
|
||||
pub auto_mongodb: bool,
|
||||
pub un_elevated: bool,
|
||||
pub toggle_grasscutter: Option<bool>,
|
||||
pub game_install_path: Option<String>,
|
||||
pub grasscutter_with_game: Option<bool>,
|
||||
pub grasscutter_path: Option<String>,
|
||||
pub java_path: Option<String>,
|
||||
pub close_action: Option<u64>,
|
||||
pub startup_launch: Option<bool>,
|
||||
pub last_ip: Option<String>,
|
||||
pub last_port: Option<String>,
|
||||
pub language: Option<String>,
|
||||
pub customBackground: Option<String>,
|
||||
pub cert_generated: Option<bool>,
|
||||
pub theme: Option<String>,
|
||||
pub https_enabled: Option<bool>,
|
||||
pub debug_enabled: Option<bool>,
|
||||
pub patch_rsa: Option<bool>,
|
||||
pub use_internal_proxy: Option<bool>,
|
||||
pub wipe_login: Option<bool>,
|
||||
pub horny_mode: Option<bool>,
|
||||
pub auto_mongodb: Option<bool>,
|
||||
pub un_elevated: Option<bool>,
|
||||
}
|
||||
|
||||
pub fn config_path() -> PathBuf {
|
||||
@@ -37,7 +38,7 @@ pub fn config_path() -> PathBuf {
|
||||
|
||||
pub fn get_config() -> Configuration {
|
||||
let path = config_path();
|
||||
let config = std::fs::read_to_string(path).unwrap();
|
||||
let config = std::fs::read_to_string(path).unwrap_or("{}".to_string());
|
||||
let config: Configuration = serde_json::from_str(&config).unwrap();
|
||||
|
||||
config
|
||||
|
||||
Reference in New Issue
Block a user