Skip to content

Commit

Permalink
fixup! fixup! fixup! path: fix posix.relative() on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Trott committed Mar 19, 2021
1 parent f7ccfd2 commit 1ec1edc
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -1018,17 +1018,17 @@ const posix = {
let resolvedAbsolute = false;

for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
const path = i >= 0 ?
args[i] :
(() => {
const _ = StringPrototypeReplace(
process.cwd(),
new RegExp(`\\${module.exports.sep}`, 'g'),
posix.sep
);
return StringPrototypeSlice(_, StringPrototypeIndexOf(_, posix.sep));
})();

let path;
if (i >= 0) {
path = args[i];
} else {
const _ = StringPrototypeReplace(
process.cwd(),
new RegExp(`\\${module.exports.sep}`, 'g'),
posix.sep
);
path = StringPrototypeSlice(_, StringPrototypeIndexOf(_, posix.sep));
}

validateString(path, 'path');

Expand Down

0 comments on commit 1ec1edc

Please sign in to comment.