Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
windows: use USERPROFILE to get the user's home dir
Browse files Browse the repository at this point in the history
Fixes GH-3461
Fixes GH-3462
  • Loading branch information
piscisaureus committed Oct 7, 2012
1 parent 621caa7 commit 9122778
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lib/module.js
Expand Up @@ -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.HOME;
} else {
var homeDir = process.env.USERPROFILE;
}

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);
}

Expand Down

0 comments on commit 9122778

Please sign in to comment.