Close #1349 Delimit NODE_PATH with ; on Windows
authorisaacs <i@izs.me>
Fri, 15 Jul 2011 22:26:15 +0000 (15:26 -0700)
committerisaacs <i@izs.me>
Sun, 17 Jul 2011 21:35:49 +0000 (14:35 -0700)
doc/api/modules.markdown
lib/module.js

index 1ceb87e..c1e3a20 100644 (file)
@@ -235,7 +235,8 @@ in pseudocode of what require.resolve does:
 
 If the `NODE_PATH` environment variable is set to a colon-delimited list
 of absolute paths, then node will search those paths for modules if they
-are not found elsewhere.
+are not found elsewhere.  (Note: On Windows, `NODE_PATH` is delimited by
+semicolons instead of colons.)
 
 Additionally, node will search in the following locations:
 
index 5e3fd84..1c3d4d3 100644 (file)
@@ -481,7 +481,8 @@ Module._initPaths = function() {
   }
 
   if (process.env['NODE_PATH']) {
-    paths = process.env['NODE_PATH'].split(':').concat(paths);
+    var splitter = process.platform === 'win32' ? ';' : ':';
+    paths = process.env['NODE_PATH'].split(splitter).concat(paths);
   }
 
   modulePaths = paths;