Skip to content

Commit 1ec1edc

Browse files
committed
fixup! fixup! fixup! path: fix posix.relative() on Windows
1 parent f7ccfd2 commit 1ec1edc

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/path.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,17 +1018,17 @@ const posix = {
10181018
let resolvedAbsolute = false;
10191019

10201020
for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
1021-
const path = i >= 0 ?
1022-
args[i] :
1023-
(() => {
1024-
const _ = StringPrototypeReplace(
1025-
process.cwd(),
1026-
new RegExp(`\\${module.exports.sep}`, 'g'),
1027-
posix.sep
1028-
);
1029-
return StringPrototypeSlice(_, StringPrototypeIndexOf(_, posix.sep));
1030-
})();
1031-
1021+
let path;
1022+
if (i >= 0) {
1023+
path = args[i];
1024+
} else {
1025+
const _ = StringPrototypeReplace(
1026+
process.cwd(),
1027+
new RegExp(`\\${module.exports.sep}`, 'g'),
1028+
posix.sep
1029+
);
1030+
path = StringPrototypeSlice(_, StringPrototypeIndexOf(_, posix.sep));
1031+
}
10321032

10331033
validateString(path, 'path');
10341034

0 commit comments

Comments
 (0)