From dd2a5d4b68892456c7d80e5bbd7043112abe3471 Mon Sep 17 00:00:00 2001 From: "Kenneth G. Franqueiro" Date: Wed, 17 Jun 2015 23:50:52 -0400 Subject: [PATCH] Fix #65: Rename Helper application on Mac OS X This fixes the helper process showing up in Activity Monitor as "Electron Helper"; it will now show up as " Helper". --- mac.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/mac.js b/mac.js index b3a5a3e..cd073c1 100644 --- a/mac.js +++ b/mac.js @@ -35,7 +35,8 @@ function buildMacApp (opts, cb, newApp) { var paths = { info1: path.join(newApp, 'Contents', 'Info.plist'), info2: path.join(newApp, 'Contents', 'Frameworks', 'Electron Helper.app', 'Contents', 'Info.plist'), - app: path.join(newApp, 'Contents', 'Resources', 'app') + app: path.join(newApp, 'Contents', 'Resources', 'app'), + helper: path.join(newApp, 'Contents', 'Frameworks', 'Electron Helper.app') } // update plist files @@ -72,6 +73,21 @@ function buildMacApp (opts, cb, newApp) { ncp(opts.dir, paths.app, {filter: common.userIgnoreFilter(opts), dereference: true}, function copied (err) { if (err) return cb(err) + function moveHelper () { + // Move helper binary before moving the parent helper app directory itself + var helperDestination = path.join(path.dirname(paths.helper), opts.name + ' Helper.app') + var helperBinary = path.join(paths.helper, 'Contents', 'MacOS', 'Electron Helper') + var helperBinaryDestination = path.join(path.dirname(helperBinary), opts.name + ' Helper') + + fs.rename(helperBinary, helperBinaryDestination, function (err) { + if (err) return cb(err) + fs.rename(paths.helper, helperDestination, function (err) { + if (err) return cb(err) + moveApp() + }) + }) + } + function moveApp () { // finally, move app into cwd var outdir = opts.out || process.cwd() @@ -122,6 +138,6 @@ function buildMacApp (opts, cb, newApp) { }) } - common.prune(opts, paths.app, cb, moveApp) + common.prune(opts, paths.app, cb, moveHelper) }) }