mirror of
https://github.com/atom/atom.git
synced 2026-01-25 23:08:18 -05:00
Remove resourcePath and devResourcePath assignment from parseCommandLine
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user