Browse Source

Allow for absolute paths to specify root module

v0.7.4-release
Ryan 16 years ago
parent
commit
ddac43f4ba
  1. 13
      src/node.js

13
src/node.js

@ -52,6 +52,13 @@ node.path = new function () {
var parts = path.split("/"); var parts = path.split("/");
return parts.slice(0, parts.length-1).join("/"); 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 // Module
@ -165,7 +172,11 @@ node.Module.prototype.exit = function (callback) {
(function () { (function () {
// Load the root module. I.E. the command line argument. // 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(); root_module.load();
node.exit = function (code) { node.exit = function (code) {

Loading…
Cancel
Save