Skip to content

Commit

Permalink
src: normalize for Windows's sake
Browse files Browse the repository at this point in the history
  • Loading branch information
Refael Ackermann authored and dead-horse committed Sep 23, 2014
1 parent b622c83 commit e9498e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,7 @@ fs.realpathSync = function realpathSync(p, cache) {
start();
}

p = pathModule.normalize(p);
if (cache) cache[original] = p;

return p;
Expand Down Expand Up @@ -1372,6 +1373,7 @@ fs.realpath = function realpath(p, cache, cb) {
function LOOP() {
// stop if scanned past end of path
if (pos >= p.length) {
p = pathModule.normalize(p);
if (cache) cache[original] = p;
return cb(null, p);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ Module.prototype._compile = function(content, filename) {

require.cache = Module._cache;

var dirname = path.dirname(filename);
var dirname = path.normalize(path.dirname(filename));

if (Module._contextLoad) {
if (self.id !== '.') {
Expand Down
5 changes: 5 additions & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1612,10 +1612,15 @@ static void Cwd(const FunctionCallbackInfo<Value>& args) {
return env->ThrowUVException(err, "uv_cwd");
}

#ifdef _WIN32
buf[0] = tolower(buf[0]);
#endif

Local<String> cwd = String::NewFromUtf8(env->isolate(),
buf,
String::kNormalString,
cwd_len - 1);

args.GetReturnValue().Set(cwd);
}

Expand Down

0 comments on commit e9498e3

Please sign in to comment.