From 0a8ff35c3adc84789d586be8ce29e2d153ef47b5 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 3 Sep 2015 10:30:08 -0700 Subject: [PATCH] :art: Pass devResourcePath as an argument to AtomApplication --- src/browser/atom-application.coffee | 14 +++++++------- src/browser/main.coffee | 14 ++++++-------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 54f444d0e..29cda2290 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -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')) diff --git a/src/browser/main.coffee b/src/browser/main.coffee index dfbbbb3ad..d14eb5bec 100644 --- a/src/browser/main.coffee +++ b/src/browser/main.coffee @@ -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()