Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

Fixes #3461
Close #3462
Close #4093
  • Loading branch information...
commit 5288ed75be97f55604867b8a46ad3594f7298035 1 parent 76ddf06
@piscisaureus piscisaureus authored
Showing with 13 additions and 5 deletions.
  1. +13 −5 lib/module.js
View
18 lib/module.js
@@ -497,16 +497,24 @@ Module.runMain = function() {
Module._load(process.argv[1], null, true);
};
-Module._initPaths = function() {
+Module._initPaths = function () {
+ var isWindows = process.platform === 'win32';
+
+ if (isWindows) {
+ var homeDir = process.env.USERPROFILE;
+ } else {
+ var homeDir = process.env.HOME;
+ }
+
var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node')];
- if (process.env['HOME']) {
- paths.unshift(path.resolve(process.env['HOME'], '.node_libraries'));
- paths.unshift(path.resolve(process.env['HOME'], '.node_modules'));
+ if (homeDir) {
+ paths.unshift(path.resolve(homeDir, '.node_libraries'));
+ paths.unshift(path.resolve(homeDir, '.node_modules'));
}
if (process.env['NODE_PATH']) {
- var splitter = process.platform === 'win32' ? ';' : ':';
+ var splitter = isWindows ? ';' : ':';
paths = process.env['NODE_PATH'].split(splitter).concat(paths);
}
Please sign in to comment.
Something went wrong with that request. Please try again.