mirror of
https://github.com/atom/atom.git
synced 2026-02-12 15:45:23 -05:00
Always provide a devResourcePath in load settings
This commit is contained in:
@@ -27,27 +27,31 @@ function isAtomRepoPath (repoPath) {
|
||||
}
|
||||
|
||||
let resourcePath
|
||||
let devResourcePath
|
||||
|
||||
if (args.resourcePath) {
|
||||
resourcePath = args.resourcePath
|
||||
devResourcePath = resourcePath
|
||||
} else {
|
||||
const stableResourcePath = path.dirname(path.dirname(__dirname))
|
||||
const defaultRepositoryPath = path.join(electron.app.getPath('home'), 'github', 'atom')
|
||||
|
||||
if (process.env.ATOM_DEV_RESOURCE_PATH) {
|
||||
devResourcePath = process.env.ATOM_DEV_RESOURCE_PATH
|
||||
} else if (isAtomRepoPath(process.cwd())) {
|
||||
devResourcePath = process.cwd()
|
||||
} else if (fs.statSyncNoException(defaultRepositoryPath)) {
|
||||
devResourcePath = defaultRepositoryPath
|
||||
} else {
|
||||
devResourcePath = stableResourcePath
|
||||
}
|
||||
|
||||
if (args.dev || args.test || args.benchmark || args.benchmarkTest) {
|
||||
if (process.env.ATOM_DEV_RESOURCE_PATH) {
|
||||
resourcePath = process.env.ATOM_DEV_RESOURCE_PATH
|
||||
} else if (isAtomRepoPath(process.cwd())) {
|
||||
resourcePath = process.cwd()
|
||||
} else if (fs.statSyncNoException(defaultRepositoryPath)) {
|
||||
resourcePath = defaultRepositoryPath
|
||||
} else {
|
||||
resourcePath = stableResourcePath
|
||||
}
|
||||
resourcePath = devResourcePath
|
||||
} else {
|
||||
resourcePath = stableResourcePath
|
||||
}
|
||||
}
|
||||
|
||||
const start = require(path.join(resourcePath, 'src', 'main-process', 'start'))
|
||||
start(resourcePath, startTime)
|
||||
start(resourcePath, devResourcePath, startTime)
|
||||
|
||||
@@ -6,7 +6,7 @@ const {app} = require('electron')
|
||||
const path = require('path')
|
||||
const fs = require('fs-plus')
|
||||
|
||||
module.exports = function parseCommandLine (processArgs, initialResourcePath) {
|
||||
module.exports = function parseCommandLine (processArgs, resourcePath, devResourcePath) {
|
||||
const options = yargs(processArgs).wrap(yargs.terminalWidth())
|
||||
const version = app.getVersion()
|
||||
options.usage(
|
||||
@@ -119,8 +119,6 @@ module.exports = function parseCommandLine (processArgs, initialResourcePath) {
|
||||
let pathsToOpen = []
|
||||
let urlsToOpen = []
|
||||
let devMode = args['dev']
|
||||
let devResourcePath = initialResourcePath
|
||||
let resourcePath = null
|
||||
|
||||
for (const path of args._) {
|
||||
if (path.startsWith('atom://')) {
|
||||
@@ -130,21 +128,8 @@ module.exports = function parseCommandLine (processArgs, initialResourcePath) {
|
||||
}
|
||||
}
|
||||
|
||||
if (args['resource-path']) {
|
||||
if (args['resource-path'] || test) {
|
||||
devMode = true
|
||||
devResourcePath = args['resource-path']
|
||||
}
|
||||
|
||||
if (test) {
|
||||
devMode = true
|
||||
}
|
||||
|
||||
if (devMode) {
|
||||
resourcePath = devResourcePath
|
||||
}
|
||||
|
||||
if (!fs.statSyncNoException(resourcePath)) {
|
||||
resourcePath = path.dirname(path.dirname(__dirname))
|
||||
}
|
||||
|
||||
if (args['path-environment']) {
|
||||
|
||||
@@ -9,7 +9,7 @@ const fs = require('fs')
|
||||
const CSON = require('season')
|
||||
const Config = require('../config')
|
||||
|
||||
module.exports = function start (initialResourcePath, startTime) {
|
||||
module.exports = function start (resourcePath, devResourcePath, startTime) {
|
||||
global.shellStartTime = startTime
|
||||
|
||||
process.on('uncaughtException', function (error = {}) {
|
||||
@@ -37,7 +37,7 @@ module.exports = function start (initialResourcePath, startTime) {
|
||||
|
||||
app.commandLine.appendSwitch('enable-experimental-web-platform-features')
|
||||
|
||||
const args = parseCommandLine(process.argv.slice(1), initialResourcePath)
|
||||
const args = parseCommandLine(process.argv.slice(1), resourcePath, devResourcePath)
|
||||
atomPaths.setAtomHome(app.getPath('home'))
|
||||
atomPaths.setUserData(app)
|
||||
setupCompileCache()
|
||||
|
||||
Reference in New Issue
Block a user