Skip to content

Commit

Permalink
Merge pull request #745 from brave/refactor_mac_app_name_generation
Browse files Browse the repository at this point in the history
Cleanup: Move mac app name generation from start.js to config.js
  • Loading branch information
simonhong authored Sep 1, 2018
2 parents 06b0cc3 + 5578b02 commit 4df26dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
11 changes: 11 additions & 0 deletions build/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,17 @@ Config.prototype.update = function (options) {
})
}

if (process.platform === 'darwin') {
Config.prototype.macAppName = function () {
let app_name = 'Brave-Browser'
if (this.channel) {
// Capitalize channel name and append it to make app name like Brave-Browser-Beta
app_name = app_name + '-' + this.channel.charAt(0).toUpperCase() + this.channel.slice(1)
}
return app_name
}
}

Object.defineProperty(Config.prototype, 'defaultOptions', {
get: function () {
let env = Object.assign({}, process.env)
Expand Down
7 changes: 1 addition & 6 deletions build/lib/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@ const start = (buildConfig = config.defaultBuildConfig, options) => {
}

if (process.platform === 'darwin') {
let product_name = 'Brave-Browser'
if (config.channel) {
// Capitalize channel name and append it to make product name like Brave-Browser-Beta
product_name = product_name + '-' + config.channel.charAt(0).toUpperCase() + config.channel.slice(1)
}
util.run(path.join(config.outputDir, product_name + '.app', 'Contents', 'MacOS', product_name), braveArgs, cmdOptions)
util.run(path.join(config.outputDir, config.macAppName() + '.app', 'Contents', 'MacOS', config.macAppName()), braveArgs, cmdOptions)
} else if (process.platform === 'win32') {
util.run(path.join(config.outputDir, 'brave.exe'), braveArgs, cmdOptions)
} else {
Expand Down

0 comments on commit 4df26dd

Please sign in to comment.