mirror of
				https://github.com/PancakeTAS/lsfg-vk.git
				synced 2025-10-30 07:01:10 +00:00 
			
		
		
		
	ui: create default configuration
This commit is contained in:
		
							parent
							
								
									abcbdbe950
								
							
						
					
					
						commit
						3c6e79823b
					
				
					 2 changed files with 7 additions and 2 deletions
				
			
		|  | @ -31,6 +31,11 @@ static CONFIG_WRITER: OnceLock<std::sync::mpsc::Sender<()>> = OnceLock::new(); | |||
| pub fn load_config() -> Result<(), anyhow::Error> { | ||||
|     // load the configuration file
 | ||||
|     let path = find_config_file(); | ||||
|     if !std::path::Path::new(&path).exists() { | ||||
|         let default_config = TomlConfig::default(); | ||||
|         save_config(&default_config) | ||||
|             .context("Failed to create default configuration")?; | ||||
|     } | ||||
|     let data = std::fs::read(path) | ||||
|         .context("Failed to read conf.toml")?; | ||||
|     let mut config: TomlConfig = toml::from_slice(&data) | ||||
|  |  | |||
|  | @ -60,7 +60,7 @@ impl Into<u32> for PresentMode { | |||
| } | ||||
| 
 | ||||
| /// Global configuration for the application
 | ||||
| #[derive(Debug, Clone, Default, Deserialize, Serialize)] | ||||
| #[derive(Debug, Default, Clone, Deserialize, Serialize)] | ||||
| pub struct TomlGlobal { | ||||
|     pub dll: Option<String> | ||||
| } | ||||
|  | @ -83,7 +83,7 @@ pub struct TomlGame { | |||
| } | ||||
| 
 | ||||
| /// Main configuration structure
 | ||||
| #[derive(Debug, Clone, Deserialize, Serialize)] | ||||
| #[derive(Debug, Default, Clone, Deserialize, Serialize)] | ||||
| pub struct TomlConfig { | ||||
|     pub version: i64, | ||||
|     #[serde(default)] | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 PancakeTAS
						PancakeTAS