Suspense start
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
cslol_dir = "WHY U RK"
|
||||
wad_dir = ""
|
||||
cslol_dir = ""
|
||||
wad_dir = "C:\\Riot Games\\League of Legends\\Game\\DATA\\FINAL\\Champions"
|
||||
extract_dir = ""
|
||||
|
||||
@@ -11,7 +11,6 @@ pub struct Config {
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn init_config() {
|
||||
// Check if the config file exists asynchronously
|
||||
if fs::metadata("config.toml").is_err() {
|
||||
let config = Config {
|
||||
cslol_dir: "".to_string(),
|
||||
@@ -23,21 +22,18 @@ pub async fn init_config() {
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn load_config() -> Config {
|
||||
pub async fn load_config() -> Config {
|
||||
let config = fs::read_to_string("config.toml")
|
||||
.expect("Failed to read config.toml file");
|
||||
print!("COMMAND \n{}", config);
|
||||
toml::from_str(&config)
|
||||
.expect("Failed to parse config.toml file")
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn write_config(config: Config) {
|
||||
// Serialize the config synchronously (no async TOML serializer by default)
|
||||
let config_content = toml::to_string(&config)
|
||||
.expect("Failed to serialize config");
|
||||
|
||||
// Write the config file asynchronously
|
||||
fs::write("config.toml", config_content)
|
||||
.expect("Failed to write to config.toml file");
|
||||
}
|
||||
Reference in New Issue
Block a user