From a57d9e1591929e6c2c5e54f9cdd0e20f220b063f Mon Sep 17 00:00:00 2001 From: Anthony Tseng Date: Sat, 6 Oct 2018 17:45:56 -0700 Subject: [PATCH] Fix user-data-dir-name switch --- lib/start.js | 11 +++++++++++ scripts/commands.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/start.js b/lib/start.js index f3fc5df5a791..27fd00f307ab 100644 --- a/lib/start.js +++ b/lib/start.js @@ -38,6 +38,17 @@ const start = (buildConfig = config.defaultBuildConfig, options) => { if (options.show_component_extensions) { braveArgs.push('--show-component-extension-options') } + if (options.user_data_dir_name) { + let user_data_dir + if (process.platform === 'darwin') { + user_data_dir = path.join(process.env.HOME, 'Library', 'Application\\ Support', 'BraveSoftware', options.user_data_dir_name) + } else if (process.platform === 'win32') { + user_data_dir = path.join(process.env.LocalAppData, 'BraveSoftware', options.user_data_dir_name) + } else { + user_data_dir = path.join(process.env.HOME, '.config', 'BraveSoftware', options.user_data_dir_name) + } + braveArgs.push('--user-data-dir=' + user_data_dir); + } let cmdOptions = { stdio: 'inherit', diff --git a/scripts/commands.js b/scripts/commands.js index 2b85237a2201..6ce83aa95d60 100644 --- a/scripts/commands.js +++ b/scripts/commands.js @@ -62,7 +62,7 @@ program .command('start') .option('--v [log_level]', 'set log level to [log_level]', parseInt, '0') .option('--vmodule [modules]', 'verbose log from specific modules') - .option('--user_data_dir_name [base_name]', 'set user data directory base name to [base_name]', 'brave-development') + .option('--user_data_dir_name [base_name]', 'set user data directory base name to [base_name]', 'Brave-Browser-Development') .option('--no_sandbox', 'disable the sandbox') .option('--disable_brave_extension', 'disable loading the Brave extension') .option('--disable_brave_rewards_extension', 'disable loading the Brave Rewards extension')