From 336f0382b5c09abe73101833cf29238aa6d6ff35 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 24 Feb 2014 16:38:17 -0800 Subject: [PATCH] Don't require ~/github/atom for dev mode windows Use ~/github/atom when available but keep the dev mode flag on the window's load settings even when it does not exist. Changes both cmd-shift-o and `atom --dev` --- src/browser/atom-application.coffee | 19 ++++++------------- src/browser/main.coffee | 3 +-- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 243e9400e..565a6dead 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -321,14 +321,6 @@ class AtomApplication # + initialSize: # Object with height and width keys. openPath: ({pathToOpen, pidToKillWhenClosed, newWindow, devMode, initialSize}={}) -> - if devMode and not fs.existsSync(global.devResourcePath) - dialog.showMessageBox - type: 'warning' - buttons: ['OK'] - message: 'Atom source directory not found.' - detail: 'To run a window in dev mode you need to have the atom/atom repo cloned to ~/github/atom' - return - if pathToOpen [basename, initialLine] = path.basename(pathToOpen).split(':') if initialLine @@ -342,11 +334,12 @@ class AtomApplication openedWindow.openPath(pathToOpen, initialLine) else if devMode - resourcePath = global.devResourcePath - bootstrapScript = require.resolve(path.join(global.devResourcePath, 'src', 'window-bootstrap')) - else - resourcePath = @resourcePath - bootstrapScript = require.resolve('../window-bootstrap') + try + bootstrapScript = require.resolve(path.join(global.devResourcePath, 'src', 'window-bootstrap')) + resourcePath = global.devResourcePath + + bootstrapScript ?= require.resolve('../window-bootstrap') + resourcePath ?= @resourcePath openedWindow = new AtomWindow({pathToOpen, initialLine, bootstrapScript, resourcePath, devMode, initialSize}) if pidToKillWhenClosed? diff --git a/src/browser/main.coffee b/src/browser/main.coffee index c72081cd7..09393c9f5 100644 --- a/src/browser/main.coffee +++ b/src/browser/main.coffee @@ -109,8 +109,7 @@ parseCommandLine = -> try fs.statSync resourcePath - catch e - devMode = false + catch resourcePath = path.dirname(path.dirname(__dirname)) {resourcePath, pathsToOpen, executedFrom, test, version, pidToKillWhenClosed, devMode, newWindow, specDirectory, logFile}