镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Closed
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
11 changes: 4 additions & 7 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1598,10 +1598,7 @@ if (isWindows) {

const emptyObj = ObjectCreate(null);
function realpathSync(p, options) {
if (!options)
options = emptyObj;
else
options = getOptions(options, emptyObj);
options = getOptions(options, emptyObj);
p = toPathIfFileURL(p);
if (typeof p !== 'string') {
p += '';
Expand Down Expand Up @@ -1633,7 +1630,7 @@ function realpathSync(p, options) {
pos = current.length;

// On windows, check that the root exists. On unix there is no need.
if (isWindows && !knownHard[base]) {
if (isWindows) {
const ctx = { path: base };
binding.lstat(pathModule.toNamespacedPath(base), false, undefined, ctx);
handleErrorFromBinding(ctx);
Expand Down Expand Up @@ -1831,7 +1828,7 @@ function realpath(p, options, callback) {
const ino = stats.ino.toString(32);
id = `${dev}:${ino}`;
if (seenLinks[id]) {
return gotTarget(null, seenLinks[id], base);
return gotTarget(null, seenLinks[id]);
}
}
fs.stat(base, (err) => {
Expand All @@ -1844,7 +1841,7 @@ function realpath(p, options, callback) {
});
}

function gotTarget(err, target, base) {
function gotTarget(err, target) {
if (err) return callback(err);

gotResolvedLink(pathModule.resolve(previous, target));
Expand Down