0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00

Allow for absolute paths to specify root module

This commit is contained in:
Ryan 2009-06-09 10:06:04 +02:00
parent 8c146dfa0b
commit ddac43f4ba

View File

@ -52,6 +52,13 @@ node.path = new function () {
var parts = path.split("/");
return parts.slice(0, parts.length-1).join("/");
};
this.filename = function (path) {
if (path.charAt(0) !== "/")
path = "./" + path;
var parts = path.split("/");
return parts[parts.length-1];
};
};
// Module
@ -165,7 +172,11 @@ node.Module.prototype.exit = function (callback) {
(function () {
// Load the root module. I.E. the command line argument.
root_module = new node.Module({ path: ARGV[1], target: this });
root_module = new node.Module({
path: node.path.filename(ARGV[1]),
base_directory: node.path.dirname(ARGV[1]),
target: this
});
root_module.load();
node.exit = function (code) {