-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
os.homedir() calls libuv's uv_os_homedir() to retrieve the current user's home directory. PR-URL: #1791 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Rod Vagg <[email protected]>
- Loading branch information
Showing
6 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
var common = require('../common'); | ||
var assert = require('assert'); | ||
var cp = require('child_process'); | ||
var os = require('os'); | ||
var path = require('path'); | ||
|
||
|
||
if (process.argv[2] === 'child') { | ||
if (common.isWindows) | ||
assert.equal(process.env.USERPROFILE, undefined); | ||
else | ||
assert.equal(process.env.HOME, undefined); | ||
|
||
var home = os.homedir(); | ||
|
||
assert.ok(typeof home === 'string'); | ||
assert.ok(home.indexOf(path.sep) !== -1); | ||
} else { | ||
if (common.isWindows) | ||
delete process.env.USERPROFILE; | ||
else | ||
delete process.env.HOME; | ||
|
||
var child = cp.spawnSync(process.execPath, [__filename, 'child'], { | ||
env: process.env | ||
}); | ||
|
||
assert.equal(child.status, 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6e78e5f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the test for Windows in common.js is not going to work on 64-bit windows:
exports.isWindows = process.platform === 'win32';
This should be used instead:
exports.isWindows = process.platform === 'win32' || process.platform === 'win64';
6e78e5f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jorangreef
process.platform
is always 'win32' on Windows, the 32/64 bits discriminator isprocess.arch
.6e78e5f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thanks.