diff --git a/lib/fs.js b/lib/fs.js index eead8bb5a39176..8196e694ae7bd4 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -1566,10 +1566,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 += ''; @@ -1601,7 +1598,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); @@ -1799,7 +1796,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) => { @@ -1812,7 +1809,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));