Skip to content

Commit a233919

Browse files
authored
fix(autostart): Fix LaunchAgent macOS autostart (#1118)
* Fix LaunchAgent macOS autostart * Add .changes
1 parent 4cd8112 commit a233919

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

.changes/fix-autolaunch-macos.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"autostart": patch
3+
---
4+
5+
Fix LaunchAgent-based autostart for macOS.

plugins/autostart/src/lib.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,12 @@ pub fn init<R: Runtime>(
129129
// exe path to not break it.
130130
let exe_path = current_exe.canonicalize()?.display().to_string();
131131
let parts: Vec<&str> = exe_path.split(".app/").collect();
132-
let app_path = if parts.len() == 2 {
133-
format!("{}.app", parts.first().unwrap())
134-
} else {
135-
exe_path
136-
};
132+
let app_path =
133+
if parts.len() == 2 && matches!(macos_launcher, MacosLauncher::AppleScript) {
134+
format!("{}.app", parts.first().unwrap())
135+
} else {
136+
exe_path
137+
};
137138
info!("auto_start path {}", &app_path);
138139
builder.set_app_path(&app_path);
139140
}

0 commit comments

Comments
 (0)