Skip to content

Commit

Permalink
require.paths aliased as process.path
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Nov 1, 2009
1 parent cf652b8 commit 9bd2717
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/node.js
Expand Up @@ -273,16 +273,15 @@ var pathModule = createInternalModule("path", function (exports) {
var path = pathModule.exports;



var modulePaths = [ path.join(process.installPrefix, "lib/node/libraries")
];
process.paths = [ path.join(process.installPrefix, "lib/node/libraries")
];

if (process.ENV["HOME"]) {
modulePaths.unshift(path.join(process.ENV["HOME"], ".node_libraries"));
process.paths.unshift(path.join(process.ENV["HOME"], ".node_libraries"));
}

if (process.ENV["NODE_PATH"]) {
modulePaths = process.ENV["NODE_PATH"].split(":").concat(modulePaths);
process.paths = process.ENV["NODE_PATH"].split(":").concat(process.paths);
}


Expand Down Expand Up @@ -348,7 +347,7 @@ function loadModule (request, parent) {
paths = [path.dirname(parent.filename)];
} else {
id = request;
paths = modulePaths;
paths = process.paths;
}

if (id in moduleCache) {
Expand Down Expand Up @@ -421,7 +420,7 @@ Module.prototype.loadScript = function (filename, loadPromise) {
return requireAsync(url).wait();
}

require.paths = modulePaths;
require.paths = process.paths;
require.async = requireAsync;

// create wrapper function
Expand Down

0 comments on commit 9bd2717

Please sign in to comment.