diff --git a/plugins/autostart/src/lib.rs b/plugins/autostart/src/lib.rs index 509e6b3f..db6b6437 100644 --- a/plugins/autostart/src/lib.rs +++ b/plugins/autostart/src/lib.rs @@ -3,6 +3,7 @@ // SPDX-License-Identifier: MIT use auto_launch::{AutoLaunch, AutoLaunchBuilder}; +use log::info; use serde::{ser::Serializer, Serialize}; use tauri::{ command, @@ -98,7 +99,6 @@ pub fn init( .invoke_handler(tauri::generate_handler![enable, disable, is_enabled]) .setup(move |app| { let mut builder = AutoLaunchBuilder::new(); - builder.set_app_name(&app.package_info().name); if let Some(args) = args { builder.set_args(&args); @@ -110,7 +110,17 @@ pub fn init( #[cfg(windows)] builder.set_app_path(¤t_exe.display().to_string()); #[cfg(target_os = "macos")] - builder.set_app_path(¤t_exe.canonicalize()?.display().to_string()); + { + let exe_path = current_exe.canonicalize()?.display().to_string(); + let parts: Vec<&str> = exe_path.split(".app/").collect(); + let app_path = format!( + "{}{}", + parts.get(0).expect("to be an app").to_string(), + ".app" + ); + info!("auto_start path {}", &app_path); + builder.set_app_path(&app_path); + } #[cfg(target_os = "linux")] if let Some(appimage) = app .env()