Internally use full paths when loading modules.
authorRyan <ry@tinyclouds.org>
Mon, 7 Sep 2009 12:09:18 +0000 (14:09 +0200)
committerRyan <ry@tinyclouds.org>
Mon, 7 Sep 2009 12:46:56 +0000 (14:46 +0200)
This completes shebang support begun in
6acac912dd4da0479a0630a8d1b2878ca83b22de.

src/node.js

index f6d0a4a..5cab833 100644 (file)
@@ -202,6 +202,15 @@ node.Module.prototype.waitChildrenLoad = function (callback) {
 };
 
 (function () {
+  // Make ARGV[0] and ARGV[1] into full paths.
+  if (ARGV[0].charAt(0) != "/") {
+    ARGV[0] = node.path.join(node.cwd(), ARGV[0]);
+  }
+
+  if (ARGV[1].charAt(0) != "/") {
+    ARGV[1] = node.path.join(node.cwd(), ARGV[1]);
+  }
+
   // Load the root module--the command line argument.
   var root_module = new node.Module({
     path: node.path.filename(ARGV[1]),