Suspense start

This commit is contained in:
poslop
2024-06-06 22:11:59 -05:00
parent 652d6053b7
commit a05d64a9c6
7 changed files with 40 additions and 60 deletions

View File

@@ -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 = ""

View File

@@ -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");
}