From 8487536280314b276ccd87788e3e8db15522c0bf Mon Sep 17 00:00:00 2001 From: probablycorey Date: Thu, 16 May 2013 17:33:12 -0700 Subject: [PATCH] Store parsed command line args in BrowserMain --- src/main.coffee | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main.coffee b/src/main.coffee index 606b28965..dbd0133d6 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -8,15 +8,19 @@ optimist = require 'optimist' class BrowserMain windowState: null - commandLineArgs: null + resourcePath: null constructor: -> - modifiedArgv = ['node'].concat(process.argv) # optimist assumes the first arg will be node - @commandLineArgs = optimist(modifiedArgv).argv @windowState = {} - @handleEvents() + @parseCommandLine() @setupNodePaths() + @handleEvents() + + parseCommandLine: -> + modifiedArgv = ['node'].concat(process.argv) # optimist assumes the first arg will be node + args = optimist(modifiedArgv).argv + @resourcePath = args['resource-path'] setupNodePaths: -> resourcePaths = [ @@ -33,7 +37,7 @@ class BrowserMain resourcePaths.push path.join(homeDir, '.atom', 'packages') resourcePaths = resourcePaths.map (relativeOrAbsolutePath) => - path.resolve @commandLineArgs['resource-path'], relativeOrAbsolutePath + path.resolve @resourcePath, relativeOrAbsolutePath process.env['NODE_PATH'] = resourcePaths.join path.delimiter @@ -52,7 +56,7 @@ class BrowserMain dialog.openFolder currentWindow, {}, (result, paths...) => new AtomWindow bootstrapScript: 'window-bootstrap', - resourcePath: @commandLineArgs['resource-path'] + resourcePath: @resourcePath class AtomWindow @windows = [] @@ -94,4 +98,4 @@ browserMain = new BrowserMain delegate.browserMainParts.preMainMessageLoopRun = -> new AtomWindow bootstrapScript: 'window-bootstrap', - resourcePath: browserMain.commandLineArgs['resource-path'] + resourcePath: browserMain.resourcePath