@@ -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