From f31471707d4ace1562af2f0afb2efcf16f5eab00 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 22 Aug 2018 12:41:36 -0700 Subject: [PATCH] Remove resourcePath and devResourcePath assignment from parseCommandLine --- src/main-process/parse-command-line.js | 19 ++----------------- src/main-process/start.js | 13 ++++++++++++- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/main-process/parse-command-line.js b/src/main-process/parse-command-line.js index 93a98607c..5d7849eac 100644 --- a/src/main-process/parse-command-line.js +++ b/src/main-process/parse-command-line.js @@ -3,10 +3,8 @@ const dedent = require('dedent') const yargs = require('yargs') const {app} = require('electron') -const path = require('path') -const fs = require('fs-plus') -module.exports = function parseCommandLine (processArgs, resourcePath, devResourcePath) { +module.exports = function parseCommandLine (processArgs) { const options = yargs(processArgs).wrap(yargs.terminalWidth()) const version = app.getVersion() options.usage( @@ -128,7 +126,7 @@ module.exports = function parseCommandLine (processArgs, resourcePath, devResour } } - if (args['resource-path'] || test) { + if (args.resourcePath || test) { devMode = true } @@ -138,12 +136,7 @@ module.exports = function parseCommandLine (processArgs, resourcePath, devResour process.env.PATH = args['path-environment'] } - resourcePath = normalizeDriveLetterName(resourcePath) - devResourcePath = normalizeDriveLetterName(devResourcePath) - return { - resourcePath, - devResourcePath, pathsToOpen, urlsToOpen, executedFrom, @@ -166,11 +159,3 @@ module.exports = function parseCommandLine (processArgs, resourcePath, devResour env: process.env } } - -function normalizeDriveLetterName (filePath) { - if (process.platform === 'win32' && filePath) { - return filePath.replace(/^([a-z]):/, ([driveLetter]) => driveLetter.toUpperCase() + ':') - } else { - return filePath - } -} diff --git a/src/main-process/start.js b/src/main-process/start.js index 8eead3d1e..10713fa4b 100644 --- a/src/main-process/start.js +++ b/src/main-process/start.js @@ -37,7 +37,10 @@ module.exports = function start (resourcePath, devResourcePath, startTime) { app.commandLine.appendSwitch('enable-experimental-web-platform-features') - const args = parseCommandLine(process.argv.slice(1), resourcePath, devResourcePath) + const args = parseCommandLine(process.argv.slice(1)) + args.resourcePath = normalizeDriveLetterName(resourcePath) + args.devResourcePath = normalizeDriveLetterName(devResourcePath) + atomPaths.setAtomHome(app.getPath('home')) atomPaths.setUserData(app) setupCompileCache() @@ -124,3 +127,11 @@ function getConfig () { return config } + +function normalizeDriveLetterName (filePath) { + if (process.platform === 'win32' && filePath) { + return filePath.replace(/^([a-z]):/, ([driveLetter]) => driveLetter.toUpperCase() + ':') + } else { + return filePath + } +}