From 657e91123a44550c7ec8d53fa75abd81bf458ed9 Mon Sep 17 00:00:00 2001 From: Fayeed Date: Tue, 11 Apr 2023 05:48:18 +0530 Subject: [PATCH 1/4] Fix multiple launcher instance on windows --- ui/src-tauri/src/main.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ui/src-tauri/src/main.rs b/ui/src-tauri/src/main.rs index 9716131ce..82e404cd8 100644 --- a/ui/src-tauri/src/main.rs +++ b/ui/src-tauri/src/main.rs @@ -63,7 +63,8 @@ pub struct AppState { } fn main() { - if has_processes_running("AD4M") > 1 { + let app_name = if std::env::consts::OS == "windows" { "AD4M.exe" } else { "AD4M" }; + if has_processes_running(app_name) > 1 { println!("AD4M is already running"); return; } @@ -130,6 +131,8 @@ fn main() { open_tray ]) .setup(move |app| { + // let wow = app.get_window("AD4M").unwrap(); + // println!("wowo {:?}", wow); let splashscreen = app.get_window("splashscreen").unwrap(); let splashscreen_clone = splashscreen.clone(); @@ -248,4 +251,10 @@ fn log_error(window: &Window, message: &str) { "Error", message ); +} + +fn find_window(window_label: &str) -> HWND { + let window_class = "tauri_app_window"; + let window_title = format!("{} ({})", window_label, window_class); + unsafe { FindWindowW(std::ptr::null(), window_title.encode_utf16().collect::>().as_ptr()) } } \ No newline at end of file From 33b183278dca9259216ba5b4a630ab1f23e79961 Mon Sep 17 00:00:00 2001 From: Fayeed Date: Tue, 11 Apr 2023 05:49:44 +0530 Subject: [PATCH 2/4] Changelog added --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index efc436661..af135f362 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,7 @@ This project _loosely_ adheres to [Semantic Versioning](https://semver.org/spec/ ### Fixed - Expression -> get would fail when executed on a Literal expression. [PR#353](https://github.com/perspect3vism/ad4m/pull/353) + - Fixed launcher breaking on windows if a new app instance is created. [PR#362](https://github.com/perspect3vism/ad4m/pull/362) ## [0.3.4] - 27/03/2023 ### Added From 12f2ebd36a916ad72e7a78d0baa10f2aba5a018c Mon Sep 17 00:00:00 2001 From: Fayeed Date: Tue, 11 Apr 2023 15:14:29 +0530 Subject: [PATCH 3/4] removed unused function --- ui/src-tauri/src/main.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ui/src-tauri/src/main.rs b/ui/src-tauri/src/main.rs index 82e404cd8..142b2bee5 100644 --- a/ui/src-tauri/src/main.rs +++ b/ui/src-tauri/src/main.rs @@ -251,10 +251,4 @@ fn log_error(window: &Window, message: &str) { "Error", message ); -} - -fn find_window(window_label: &str) -> HWND { - let window_class = "tauri_app_window"; - let window_title = format!("{} ({})", window_label, window_class); - unsafe { FindWindowW(std::ptr::null(), window_title.encode_utf16().collect::>().as_ptr()) } } \ No newline at end of file From 61cdd6e2126dcf8048e44ee1e9933167a5a9577b Mon Sep 17 00:00:00 2001 From: Fayeed Pawaskar Date: Wed, 12 Apr 2023 02:55:32 +0530 Subject: [PATCH 4/4] Remove commented code Co-authored-by: Nicolas Luck --- ui/src-tauri/src/main.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/ui/src-tauri/src/main.rs b/ui/src-tauri/src/main.rs index 142b2bee5..ce0b9a3ab 100644 --- a/ui/src-tauri/src/main.rs +++ b/ui/src-tauri/src/main.rs @@ -131,8 +131,6 @@ fn main() { open_tray ]) .setup(move |app| { - // let wow = app.get_window("AD4M").unwrap(); - // println!("wowo {:?}", wow); let splashscreen = app.get_window("splashscreen").unwrap(); let splashscreen_clone = splashscreen.clone();