Skip to content

Commit

Permalink
[BUGFIX] always normalize paths to posix (not windows \)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanpenner committed Mar 3, 2016
1 parent 5ac72e4 commit f763aff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
var throwOnRootAccess = true;
var ensurePosix = require('ensure-posix-path');

function resolveModules(options) {
options = options || {};

if (options.throwOnRootAccess === false) {
throwOnRootAccess = false;
}

return moduleResolve;
}

function moduleResolve(child, name) {
function moduleResolve(_child, _name) {
var child = ensurePosix(_child);
var name = ensurePosix(_name);
if (child.charAt(0) !== '.') { return child; }

var parts = child.split('/');
Expand All @@ -30,7 +33,6 @@ function moduleResolve(child, name) {
}
parentBase.pop();
} else if (part === '.') {

continue;
} else { parentBase.push(part); }
}
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"devDependencies": {
"chai": "^3.0.0",
"mocha": "^2.2.5"
},
"dependencies": {
"ensure-posix-path": "^1.0.1"
}
}

0 comments on commit f763aff

Please sign in to comment.