mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Setup node path in Atom Window.
This lets windows run code from different resource paths.
This commit is contained in:
@@ -46,7 +46,6 @@ class AtomApplication
|
||||
@windows = []
|
||||
|
||||
@listenForArgumentsFromNewProcess()
|
||||
@setupNodePath()
|
||||
@setupJavaScriptArguments()
|
||||
@buildApplicationMenu()
|
||||
@handleEvents()
|
||||
@@ -69,29 +68,6 @@ class AtomApplication
|
||||
addWindow: (window) ->
|
||||
@windows.push window
|
||||
|
||||
getHomeDir: ->
|
||||
process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']
|
||||
|
||||
setupNodePath: ->
|
||||
resourcePaths = [
|
||||
'src/stdlib'
|
||||
'src/app'
|
||||
'src/packages'
|
||||
'src'
|
||||
'vendor'
|
||||
'static'
|
||||
'node_modules'
|
||||
'spec'
|
||||
''
|
||||
]
|
||||
|
||||
resourcePaths.push path.join(@getHomeDir(), '.atom', 'packages')
|
||||
|
||||
resourcePaths = resourcePaths.map (relativeOrAbsolutePath) =>
|
||||
path.resolve @resourcePath, relativeOrAbsolutePath
|
||||
|
||||
process.env['NODE_PATH'] = resourcePaths.join path.delimiter
|
||||
|
||||
listenForArgumentsFromNewProcess: ->
|
||||
fs.unlinkSync socketPath if fs.existsSync(socketPath)
|
||||
server = net.createServer (connection) =>
|
||||
|
||||
@@ -11,6 +11,7 @@ class AtomWindow
|
||||
constructor: ({bootstrapScript, resourcePath, pathToOpen, exitWhenDone, @isSpec}) ->
|
||||
global.atomApplication.addWindow(this)
|
||||
|
||||
@setupNodePath(resourcePath)
|
||||
@browserWindow = new BrowserWindow show: false, title: 'Atom'
|
||||
@handleEvents()
|
||||
|
||||
@@ -24,6 +25,26 @@ class AtomWindow
|
||||
|
||||
@openPath(pathToOpen)
|
||||
|
||||
setupNodePath: (resourcePath) ->
|
||||
paths = [
|
||||
'src/stdlib'
|
||||
'src/app'
|
||||
'src/packages'
|
||||
'src'
|
||||
'vendor'
|
||||
'static'
|
||||
'node_modules'
|
||||
'spec'
|
||||
''
|
||||
]
|
||||
|
||||
paths.push path.join(global.homeDir, '.atom', 'packages')
|
||||
|
||||
paths = paths.map (relativeOrAbsolutePath) ->
|
||||
path.resolve resourcePath, relativeOrAbsolutePath
|
||||
|
||||
process.env['NODE_PATH'] = paths.join path.delimiter
|
||||
|
||||
getInitialPath: ->
|
||||
@browserWindow.loadSettings.initialPath
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ $ = require 'jquery'
|
||||
fsUtils = require 'fs-utils'
|
||||
path = require 'path'
|
||||
|
||||
describe 'FuzzyFinder', ->
|
||||
fdescribe 'FuzzyFinder', ->
|
||||
[finderView] = []
|
||||
|
||||
beforeEach ->
|
||||
|
||||
Reference in New Issue
Block a user