Skip to content

Commit

Permalink
Merge pull request brave#11901 from brave/issue-11900
Browse files Browse the repository at this point in the history
Automatically add user-data-dir-name to non Release channels
  • Loading branch information
bsclifton authored Nov 12, 2017
2 parents 559144f + c0b2109 commit fe63aae
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ if (process.platform === 'win32') {
require('./windowsInit')
}

if (process.platform === 'linux') {
require('./linuxInit')
}

const electron = require('electron')
const app = electron.app
const ipcMain = electron.ipcMain
Expand Down
20 changes: 20 additions & 0 deletions app/linuxInit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

const electron = require('electron')
const app = electron.app
const Channel = require('./channel')

if (process.platform === 'linux') {
const channel = Channel.channel()

const userDataDirSwitch = '--user-data-dir-name=brave-' + channel
if (channel !== 'dev' && !process.argv.includes(userDataDirSwitch) &&
!process.argv.includes('--relaunch') &&
!process.argv.includes('--user-data-dir-name=brave-development')) {
delete process.env.CHROME_USER_DATA_DIR
app.relaunch({args: process.argv.slice(1).concat([userDataDirSwitch, '--relaunch'])})
app.exit()
}
}

0 comments on commit fe63aae

Please sign in to comment.