Skip to content

Commit 0a17a62

Browse files
committed
5.0.4: fix path when using Launch Agent for Mac apps
1 parent 07c22a6 commit 0a17a62

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "auto-launch",
3-
"version": "5.0.3",
3+
"version": "5.0.4",
44
"description": "Launch node applications or executables at login (Mac, Windows, and Linux)",
55
"main": "dist/index.js",
66
"scripts": {

src/index.coffee

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ module.exports = class AutoLaunch
6060

6161
# Corrects the path to point to the outer .app
6262
# path - {String}
63+
# macOptions - {Object}
6364
# Returns a {String}
64-
fixMacExecPath: (path) ->
65+
fixMacExecPath: (path, macOptions) ->
6566
# This will match apps whose inner app and executable's basename is the outer app's basename plus "Helper"
6667
# (the default Electron app structure for example)
6768
# It will also match apps whose outer app's basename is different to the rest but the inner app and executable's
@@ -70,15 +71,16 @@ module.exports = class AutoLaunch
7071
# Also matches when the path is pointing not to the exectuable in the inner app at all but to the Electron
7172
# executable in the outer app
7273
path = path.replace /(^.+?[^\/]+?\.app)\/Contents\/(Frameworks\/((\1|[^\/]+?) Helper)\.app\/Contents\/MacOS\/\3|MacOS\/Electron)/, '$1'
73-
path = path.replace /\.app\/Contents\/MacOS\/[^\/]*$/, '.app'
74+
# When using a launch agent, it needs the inner executable path
75+
path = path.replace /\.app\/Contents\/MacOS\/[^\/]*$/, '.app' unless macOptions.useLaunchAgent
7476
return path
7577

7678

7779
fixOpts: =>
7880
@opts.appPath = @opts.appPath.replace /\/$/, ''
7981

8082
if /darwin/.test process.platform
81-
@opts.appPath = @fixMacExecPath(@opts.appPath)
83+
@opts.appPath = @fixMacExecPath(@opts.appPath, @opts.mac)
8284

8385
if @opts.appPath.indexOf('/') isnt -1
8486
tempPath = @opts.appPath.split '/'

0 commit comments

Comments
 (0)