Browse files

~ expansion in path.normalize not ~username #2857

  • Loading branch information...
1 parent 0613af0 commit 6b2f30d1a23ad15a83d1eb0b502bca14d03f695b ssuda committed Mar 2, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 lib/path.js
View
2 lib/path.js
@@ -160,6 +160,7 @@ if (isWindows) {
// windows version
exports.normalize = function(path) {
+ path = path.replace(/^~/, process.env['HOMEDRIVE'] + process.env['HOMEPATH']);
var result = splitDeviceRe.exec(path),
device = result[1] || '',
isUnc = device && device.charAt(1) !== ':',
@@ -302,6 +303,7 @@ if (isWindows) {
// path.normalize(path)
// posix version
exports.normalize = function(path) {
+ path = path.replace(/^~/, process.env['HOME']);
var isAbsolute = path.charAt(0) === '/',
trailingSlash = path.slice(-1) === '/';

0 comments on commit 6b2f30d

Please sign in to comment.