Skip to content

Commit

Permalink
fixup! path: fix posix.relative() on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Trott committed Mar 14, 2021
1 parent 1121d36 commit 1042b58
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ const {
FunctionPrototypeBind,
RegExp,
StringPrototypeCharCodeAt,
StringPrototypeIndexOf,
StringPrototypeLastIndexOf,
StringPrototypeReplace,
StringPrototypeSlice,
StringPrototypeToLowerCase,
} = primordials;

const {
CHAR_UPPERCASE_A,
CHAR_LOWERCASE_A,
Expand Down Expand Up @@ -1018,9 +1021,12 @@ const posix = {
const path = i >= 0 ?
args[i] :
(() => {
const _ = process.cwd()
.replace(new RegExp(`\\${module.exports.sep}`, 'g'), posix.sep);
return _.substr(_.indexOf(posix.sep));
const _ = StringPrototypeReplace(
process.cwd(),
new RegExp(`\\${module.exports.sep}`, 'g'),
posix.sep
);
return StringPrototypeSlice(_, StringPrototypeIndexOf(_, posix.sep));
})();


Expand Down

0 comments on commit 1042b58

Please sign in to comment.