fix(autostart): Fix LaunchAgent macOS autostart (#1118)

* Fix LaunchAgent macOS autostart

* Add .changes
This commit is contained in:
venkr
2024-03-26 11:01:57 -07:00
committed by GitHub
parent 4cd81126fd
commit a2339195aa
2 changed files with 11 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"autostart": patch
---
Fix LaunchAgent-based autostart for macOS.
+6 -5
View File
@@ -129,11 +129,12 @@ pub fn init<R: Runtime>(
// exe path to not break it.
let exe_path = current_exe.canonicalize()?.display().to_string();
let parts: Vec<&str> = exe_path.split(".app/").collect();
let app_path = if parts.len() == 2 {
format!("{}.app", parts.first().unwrap())
} else {
exe_path
};
let app_path =
if parts.len() == 2 && matches!(macos_launcher, MacosLauncher::AppleScript) {
format!("{}.app", parts.first().unwrap())
} else {
exe_path
};
info!("auto_start path {}", &app_path);
builder.set_app_path(&app_path);
}