Skip to content

Commit

Permalink
Merge pull request #12714 from jasongrout/uncpaths
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Mar 6, 2021
2 parents 0ffeaf0 + 194ba96 commit e28788a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/util/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ const path = require("path");
const relative = (fs, rootPath, targetPath) => {
if (fs && fs.relative) {
return fs.relative(rootPath, targetPath);
} else if (rootPath.startsWith("/")) {
} else if (path.posix.isAbsolute(rootPath)) {
return path.posix.relative(rootPath, targetPath);
} else if (rootPath.length > 1 && rootPath[1] === ":") {
} else if (path.win32.isAbsolute(rootPath)) {
return path.win32.relative(rootPath, targetPath);
} else {
throw new Error(
Expand All @@ -158,9 +158,9 @@ exports.relative = relative;
const join = (fs, rootPath, filename) => {
if (fs && fs.join) {
return fs.join(rootPath, filename);
} else if (rootPath.startsWith("/")) {
} else if (path.posix.isAbsolute(rootPath)) {
return path.posix.join(rootPath, filename);
} else if (rootPath.length > 1 && rootPath[1] === ":") {
} else if (path.win32.isAbsolute(rootPath)) {
return path.win32.join(rootPath, filename);
} else {
throw new Error(
Expand All @@ -178,9 +178,9 @@ exports.join = join;
const dirname = (fs, absPath) => {
if (fs && fs.dirname) {
return fs.dirname(absPath);
} else if (absPath.startsWith("/")) {
} else if (path.posix.isAbsolute(absPath)) {
return path.posix.dirname(absPath);
} else if (absPath.length > 1 && absPath[1] === ":") {
} else if (path.win32.isAbsolute(absPath)) {
return path.win32.dirname(absPath);
} else {
throw new Error(
Expand Down

0 comments on commit e28788a

Please sign in to comment.