From 77380e357c6183d9db994a1f29953468684df113 Mon Sep 17 00:00:00 2001 From: Thoronium <107363768+NotThorny@users.noreply.github.com> Date: Wed, 5 Apr 2023 21:26:47 -0600 Subject: [PATCH] Show wrench instantly on setting 3dmigoto --- src-tauri/src/system_helpers.rs | 4 +++- src/ui/Main.tsx | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/system_helpers.rs b/src-tauri/src/system_helpers.rs index 5eb249e..bed704e 100644 --- a/src-tauri/src/system_helpers.rs +++ b/src-tauri/src/system_helpers.rs @@ -97,7 +97,7 @@ pub fn install_location() -> String { } #[tauri::command] -pub fn set_migoto_target(migoto_path: String) -> bool { +pub fn set_migoto_target(window: tauri::Window, migoto_path: String) -> bool { let mut migoto_pathbuf = PathBuf::from(migoto_path); migoto_pathbuf.pop(); @@ -114,6 +114,8 @@ pub fn set_migoto_target(migoto_path: String) -> bool { } }; + window.emit("migoto_set", &()).unwrap(); + // Set options conf .with_section(Some("Loader")) diff --git a/src/ui/Main.tsx b/src/ui/Main.tsx index 37c50ce..61deed1 100644 --- a/src/ui/Main.tsx +++ b/src/ui/Main.tsx @@ -78,6 +78,14 @@ export class Main extends React.Component { } }) + listen('migoto_set', async () => { + this.setState({ + migotoSet: !!(await getConfigOption('migoto_path')), + }) + + window.location.reload() + }) + // Emitted for automatic processes listen('grasscutter_closed', async () => { const autoService = await getConfigOption('auto_mongodb')