Clear node's global search paths
This commit is contained in:
parent
021ee20400
commit
9fe326ebeb
3 changed files with 8 additions and 17 deletions
|
@ -7,14 +7,14 @@ Module = require 'module'
|
||||||
# we need to restore it here.
|
# we need to restore it here.
|
||||||
process.argv.splice 1, 1
|
process.argv.splice 1, 1
|
||||||
|
|
||||||
|
# Import common settings.
|
||||||
|
require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init')
|
||||||
|
|
||||||
# Add browser/api/lib to module search paths, which contains javascript part of
|
# Add browser/api/lib to module search paths, which contains javascript part of
|
||||||
# Electron's built-in libraries.
|
# Electron's built-in libraries.
|
||||||
globalPaths = Module.globalPaths
|
globalPaths = Module.globalPaths
|
||||||
globalPaths.push path.resolve(__dirname, '..', 'api', 'lib')
|
globalPaths.push path.resolve(__dirname, '..', 'api', 'lib')
|
||||||
|
|
||||||
# Import common settings.
|
|
||||||
require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init')
|
|
||||||
|
|
||||||
if process.platform is 'win32'
|
if process.platform is 'win32'
|
||||||
# Redirect node's console to use our own implementations, since node can not
|
# Redirect node's console to use our own implementations, since node can not
|
||||||
# handle console output when running as GUI program.
|
# handle console output when running as GUI program.
|
||||||
|
|
|
@ -9,18 +9,9 @@ process.atomBinding = (name) ->
|
||||||
catch e
|
catch e
|
||||||
process.binding "atom_common_#{name}" if /No such module/.test e.message
|
process.binding "atom_common_#{name}" if /No such module/.test e.message
|
||||||
|
|
||||||
# Global module search paths.
|
# Clear node's global search paths.
|
||||||
globalPaths = Module.globalPaths
|
globalPaths = Module.globalPaths
|
||||||
|
globalPaths.length = 0
|
||||||
# Don't lookup modules in user-defined search paths, see http://git.io/vf8sF.
|
|
||||||
homeDir =
|
|
||||||
if process.platform is 'win32'
|
|
||||||
process.env.USERPROFILE
|
|
||||||
else
|
|
||||||
process.env.HOME
|
|
||||||
if homeDir # Node only add user-defined search paths when $HOME is defined.
|
|
||||||
userModulePath = path.resolve homeDir, '.node_modules'
|
|
||||||
globalPaths.splice globalPaths.indexOf(userModulePath), 2
|
|
||||||
|
|
||||||
# Add common/api/lib to module search paths.
|
# Add common/api/lib to module search paths.
|
||||||
globalPaths.push path.resolve(__dirname, '..', 'api', 'lib')
|
globalPaths.push path.resolve(__dirname, '..', 'api', 'lib')
|
||||||
|
|
|
@ -7,14 +7,14 @@ Module = require 'module'
|
||||||
# atom-renderer.js, we need to restore it here.
|
# atom-renderer.js, we need to restore it here.
|
||||||
process.argv.splice 1, 1
|
process.argv.splice 1, 1
|
||||||
|
|
||||||
|
# Import common settings.
|
||||||
|
require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init')
|
||||||
|
|
||||||
# Add renderer/api/lib to require's search paths, which contains javascript part
|
# Add renderer/api/lib to require's search paths, which contains javascript part
|
||||||
# of Atom's built-in libraries.
|
# of Atom's built-in libraries.
|
||||||
globalPaths = Module.globalPaths
|
globalPaths = Module.globalPaths
|
||||||
globalPaths.push path.resolve(__dirname, '..', 'api', 'lib')
|
globalPaths.push path.resolve(__dirname, '..', 'api', 'lib')
|
||||||
|
|
||||||
# Import common settings.
|
|
||||||
require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init')
|
|
||||||
|
|
||||||
# The global variable will be used by ipc for event dispatching
|
# The global variable will be used by ipc for event dispatching
|
||||||
v8Util = process.atomBinding 'v8_util'
|
v8Util = process.atomBinding 'v8_util'
|
||||||
v8Util.setHiddenValue global, 'ipc', new events.EventEmitter
|
v8Util.setHiddenValue global, 'ipc', new events.EventEmitter
|
||||||
|
|
Loading…
Reference in a new issue