🎨 Pass devResourcePath as an argument to AtomApplication

This commit is contained in:
Max Brunsfeld
2015-09-03 10:30:08 -07:00
parent ed62685c78
commit 0a8ff35c3a
2 changed files with 13 additions and 15 deletions

View File

@@ -63,7 +63,7 @@ class AtomApplication
exit: (status) -> app.exit(status)
constructor: (options) ->
{@resourcePath, @version, @devMode, @safeMode, @socketPath} = options
{@resourcePath, @devResourcePath, @version, @devMode, @safeMode, @socketPath} = options
global.atomApplication = this
@@ -160,7 +160,7 @@ class AtomApplication
devMode: @focusedWindow()?.devMode
safeMode: @focusedWindow()?.safeMode
@on 'application:run-all-specs', -> @runSpecs(exitWhenDone: false, resourcePath: global.devResourcePath, safeMode: @focusedWindow()?.safeMode)
@on 'application:run-all-specs', -> @runSpecs(exitWhenDone: false, resourcePath: @devResourcePath, safeMode: @focusedWindow()?.safeMode)
@on 'application:run-benchmarks', -> @runBenchmarks()
@on 'application:quit', -> app.quit()
@on 'application:new-window', -> @openPath(_.extend(windowDimensions: @focusedWindow()?.getDimensions(), getLoadSettings()))
@@ -252,7 +252,7 @@ class AtomApplication
@applicationMenu.update(win, template, keystrokesByCommand)
ipc.on 'run-package-specs', (event, specDirectory) =>
@runSpecs({resourcePath: global.devResourcePath, specDirectory: specDirectory, exitWhenDone: false})
@runSpecs({resourcePath: @devResourcePath, specDirectory: specDirectory, exitWhenDone: false})
ipc.on 'command', (event, command) =>
@emit(command)
@@ -398,8 +398,8 @@ class AtomApplication
else
if devMode
try
bootstrapScript = require.resolve(path.join(global.devResourcePath, 'src', 'window-bootstrap'))
resourcePath = global.devResourcePath
bootstrapScript = require.resolve(path.join(@devResourcePath, 'src', 'window-bootstrap'))
resourcePath = @devResourcePath
bootstrapScript ?= require.resolve('../window-bootstrap')
resourcePath ?= @resourcePath
@@ -500,7 +500,7 @@ class AtomApplication
resourcePath = @resourcePath
try
bootstrapScript = require.resolve(path.resolve(global.devResourcePath, 'spec', 'spec-bootstrap'))
bootstrapScript = require.resolve(path.resolve(@devResourcePath, 'spec', 'spec-bootstrap'))
catch error
bootstrapScript = require.resolve(path.resolve(__dirname, '..', '..', 'spec', 'spec-bootstrap'))
@@ -511,7 +511,7 @@ class AtomApplication
runBenchmarks: ({exitWhenDone, specDirectory}={}) ->
try
bootstrapScript = require.resolve(path.resolve(global.devResourcePath, 'benchmark', 'benchmark-bootstrap'))
bootstrapScript = require.resolve(path.resolve(@devResourcePath, 'benchmark', 'benchmark-bootstrap'))
catch error
bootstrapScript = require.resolve(path.resolve(__dirname, '..', '..', 'benchmark', 'benchmark-bootstrap'))

View File

@@ -53,10 +53,6 @@ normalizeDriveLetterName = (filePath) ->
else
filePath
global.devResourcePath = normalizeDriveLetterName(
process.env.ATOM_DEV_RESOURCE_PATH ? path.join(app.getHomeDir(), 'github', 'atom')
)
setupUncaughtExceptionHandler = ->
process.on 'uncaughtException', (error={}) ->
console.log(error.message) if error.message?
@@ -142,6 +138,7 @@ parseCommandLine = ->
socketPath = args['socket-path']
profileStartup = args['profile-startup']
urlsToOpen = []
devResourcePath = process.env.ATOM_DEV_RESOURCE_PATH ? path.join(app.getHomeDir(), 'github', 'atom')
if args['resource-path']
devMode = true
@@ -157,7 +154,7 @@ parseCommandLine = ->
resourcePath = packageDirectoryPath if packageManifest.name is 'atom'
if devMode
resourcePath ?= global.devResourcePath
resourcePath ?= devResourcePath
unless fs.statSyncNoException(resourcePath)
resourcePath = path.dirname(path.dirname(__dirname))
@@ -167,9 +164,10 @@ parseCommandLine = ->
process.env.PATH = args['path-environment'] if args['path-environment']
resourcePath = normalizeDriveLetterName(resourcePath)
devResourcePath = normalizeDriveLetterName(devResourcePath)
{resourcePath, pathsToOpen, urlsToOpen, executedFrom, test, version,
pidToKillWhenClosed, devMode, safeMode, newWindow, specDirectory, logFile,
socketPath, profileStartup}
{resourcePath, devResourcePath, pathsToOpen, urlsToOpen, executedFrom, test,
version, pidToKillWhenClosed, devMode, safeMode, newWindow, specDirectory,
logFile, socketPath, profileStartup}
start()