Also remove user-defined search paths in renderer
This commit is contained in:
parent
fad977e27d
commit
500d15f53a
2 changed files with 16 additions and 16 deletions
|
@ -1,27 +1,15 @@
|
||||||
fs = require 'fs'
|
fs = require 'fs'
|
||||||
path = require 'path'
|
path = require 'path'
|
||||||
module = require 'module'
|
|
||||||
util = require 'util'
|
util = require 'util'
|
||||||
|
Module = require 'module'
|
||||||
|
|
||||||
# We modified the original process.argv to let node.js load the atom.js,
|
# We modified the original process.argv to let node.js load the atom.js,
|
||||||
# we need to restore it here.
|
# we need to restore it here.
|
||||||
process.argv.splice 1, 1
|
process.argv.splice 1, 1
|
||||||
|
|
||||||
# Global module search paths.
|
|
||||||
globalPaths = module.globalPaths
|
|
||||||
|
|
||||||
# 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 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.push path.resolve(__dirname, '..', 'api', 'lib')
|
globalPaths.push path.resolve(__dirname, '..', 'api', 'lib')
|
||||||
|
|
||||||
# Import common settings.
|
# Import common settings.
|
||||||
|
@ -101,4 +89,4 @@ app.setPath 'userCache', path.join(app.getPath('cache'), app.getName())
|
||||||
require './chrome-extension'
|
require './chrome-extension'
|
||||||
|
|
||||||
# Finally load app's main.js and transfer control to C++.
|
# Finally load app's main.js and transfer control to C++.
|
||||||
module._load path.join(packagePath, packageJson.main), module, true
|
Module._load path.join(packagePath, packageJson.main), Module, true
|
||||||
|
|
|
@ -10,8 +10,20 @@ 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
|
||||||
|
|
||||||
# Add common/api/lib to module search paths.
|
# Global module search paths.
|
||||||
globalPaths = Module.globalPaths
|
globalPaths = Module.globalPaths
|
||||||
|
|
||||||
|
# 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.
|
||||||
globalPaths.push path.resolve(__dirname, '..', 'api', 'lib')
|
globalPaths.push path.resolve(__dirname, '..', 'api', 'lib')
|
||||||
|
|
||||||
# setImmediate and process.nextTick makes use of uv_check and uv_prepare to
|
# setImmediate and process.nextTick makes use of uv_check and uv_prepare to
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue