Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 19d7113

Browse filesBrowse files
himself65MylesBorins
authored andcommitted
fs: simplify realpathSync
PR-URL: #35413 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 0a1474d commit 19d7113
Copy full SHA for 19d7113

File tree

Expand file treeCollapse file tree

1 file changed

+4
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-7
lines changed
Open diff view settings
Collapse file

‎lib/fs.js‎

Copy file name to clipboardExpand all lines: lib/fs.js
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,10 +1566,7 @@ if (isWindows) {
15661566

15671567
const emptyObj = ObjectCreate(null);
15681568
function realpathSync(p, options) {
1569-
if (!options)
1570-
options = emptyObj;
1571-
else
1572-
options = getOptions(options, emptyObj);
1569+
options = getOptions(options, emptyObj);
15731570
p = toPathIfFileURL(p);
15741571
if (typeof p !== 'string') {
15751572
p += '';
@@ -1601,7 +1598,7 @@ function realpathSync(p, options) {
16011598
pos = current.length;
16021599

16031600
// On windows, check that the root exists. On unix there is no need.
1604-
if (isWindows && !knownHard[base]) {
1601+
if (isWindows) {
16051602
const ctx = { path: base };
16061603
binding.lstat(pathModule.toNamespacedPath(base), false, undefined, ctx);
16071604
handleErrorFromBinding(ctx);
@@ -1799,7 +1796,7 @@ function realpath(p, options, callback) {
17991796
const ino = stats.ino.toString(32);
18001797
id = `${dev}:${ino}`;
18011798
if (seenLinks[id]) {
1802-
return gotTarget(null, seenLinks[id], base);
1799+
return gotTarget(null, seenLinks[id]);
18031800
}
18041801
}
18051802
fs.stat(base, (err) => {
@@ -1812,7 +1809,7 @@ function realpath(p, options, callback) {
18121809
});
18131810
}
18141811

1815-
function gotTarget(err, target, base) {
1812+
function gotTarget(err, target) {
18161813
if (err) return callback(err);
18171814

18181815
gotResolvedLink(pathModule.resolve(previous, target));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.