From 87b95128f936ef10ae49f062864a85f831737f44 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 18 Mar 2014 15:34:24 +0800 Subject: [PATCH] Do not rely on NODE_PATH env. --- src/atom.coffee | 3 +++ src/browser/atom-window.coffee | 8 -------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 5905902cd..2fe132bce 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -148,6 +148,9 @@ class Atom extends Model {devMode, resourcePath} = @getLoadSettings() configDirPath = @getConfigDirPath() + # Add 'src/exports' to module search path. + require('module').globalPaths.push(path.resolve(resourcePath, 'exports')) + @config = new Config({configDirPath, resourcePath}) @keymap = new Keymap({configDirPath, resourcePath}) @packages = new PackageManager({devMode, configDirPath, resourcePath}) diff --git a/src/browser/atom-window.coffee b/src/browser/atom-window.coffee index 618ed06ef..33389403c 100644 --- a/src/browser/atom-window.coffee +++ b/src/browser/atom-window.coffee @@ -21,12 +21,7 @@ class AtomWindow {@resourcePath, pathToOpen, initialLine, @isSpec, @exitWhenDone} = settings global.atomApplication.addWindow(this) - @setupNodePath(@resourcePath) @browserWindow = new BrowserWindow show: false, title: 'Atom', icon: @constructor.iconPath - @browserWindow.restart = _.wrap _.bind(@browserWindow.restart, @browserWindow), (restart) => - @setupNodePath(@resourcePath) - restart() - @handleEvents() loadSettings = _.extend({}, settings) @@ -49,9 +44,6 @@ class AtomWindow @openPath(pathToOpen, initialLine) - setupNodePath: (resourcePath) -> - process.env['NODE_PATH'] = path.resolve(resourcePath, 'exports') - getUrl: (loadSettingsObj) -> # Ignore the windowState when passing loadSettings via URL, since it could # be quite large.