Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

windows: use USERPROFILE to get the user's home dir

Fixes #3461
Close #3462
Close #4093
  • Loading branch information...
commit 5288ed75be97f55604867b8a46ad3594f7298035 1 parent 76ddf06
Bert Belder authored October 09, 2012

Showing 1 changed file with 13 additions and 5 deletions. Show diff stats Hide diff stats

  1. 18  lib/module.js
18  lib/module.js
@@ -497,16 +497,24 @@ Module.runMain = function() {
497 497
   Module._load(process.argv[1], null, true);
498 498
 };
499 499
 
500  
-Module._initPaths = function() {
  500
+Module._initPaths = function () {
  501
+  var isWindows = process.platform === 'win32';
  502
+
  503
+  if (isWindows) {
  504
+    var homeDir = process.env.USERPROFILE;
  505
+  } else {
  506
+    var homeDir = process.env.HOME;
  507
+  }
  508
+
501 509
   var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node')];
502 510
 
503  
-  if (process.env['HOME']) {
504  
-    paths.unshift(path.resolve(process.env['HOME'], '.node_libraries'));
505  
-    paths.unshift(path.resolve(process.env['HOME'], '.node_modules'));
  511
+  if (homeDir) {
  512
+    paths.unshift(path.resolve(homeDir, '.node_libraries'));
  513
+    paths.unshift(path.resolve(homeDir, '.node_modules'));
506 514
   }
507 515
 
508 516
   if (process.env['NODE_PATH']) {
509  
-    var splitter = process.platform === 'win32' ? ';' : ':';
  517
+    var splitter = isWindows ? ';' : ':';
510 518
     paths = process.env['NODE_PATH'].split(splitter).concat(paths);
511 519
   }
512 520
 

0 notes on commit 5288ed7

Please sign in to comment.
Something went wrong with that request. Please try again.