Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
const {
ArrayPrototypeIncludes,
ArrayPrototypeJoin,
ArrayPrototypePush,
ArrayPrototypeSlice,
FunctionPrototypeBind,
StringPrototypeCharCodeAt,
Expand Down Expand Up @@ -506,22 +507,21 @@ const win32 = {
if (args.length === 0)
return '.';

let joined;
let firstPart;
const path = [];
for (let i = 0; i < args.length; ++i) {
const arg = args[i];
validateString(arg, 'path');
if (arg.length > 0) {
if (joined === undefined)
joined = firstPart = arg;
else
joined += `\\${arg}`;
ArrayPrototypePush(path, arg);
}
}

if (joined === undefined)
if (path.length === 0)
return '.';

const firstPart = path[0];
let joined = ArrayPrototypeJoin(path, '\\');

// Make sure that the joined path doesn't start with two slashes, because
// normalize() will mistake it for a UNC path then.
//
Expand Down
Loading