Skip to content

Commit

Permalink
fix(autostart): Fix LaunchAgent macOS autostart (#1118)
Browse files Browse the repository at this point in the history
* Fix LaunchAgent macOS autostart

* Add .changes
  • Loading branch information
venkr authored Mar 26, 2024
1 parent 4cd8112 commit a233919
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-autolaunch-macos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"autostart": patch
---

Fix LaunchAgent-based autostart for macOS.
11 changes: 6 additions & 5 deletions plugins/autostart/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit a233919

Please sign in to comment.