Skip to content

doc: clarify symlink resolution for __filename - #24587

Closed
Trott wants to merge 2 commits into
nodejs:masterfrom
Trott:resolved
Closed

doc: clarify symlink resolution for __filename#24587
Trott wants to merge 2 commits into
nodejs:masterfrom
Trott:resolved

Conversation

@Trott

Copy link
Copy Markdown
Member

Make it more explicit that symlinks are resolved in __filename.

Refs: #22602 (comment)

/ping @sam-github@Pomax

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines

Make it more explicit that symlinks are resolved in `__filename`.
Refs: nodejs#22602 (comment)
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-botnodejs-github-bot added doc Issues and PRs related to the documentations. module Issues and PRs related to the module subsystem. labels Nov 24, 2018
Comment threaddoc/api/modules.md Outdated

The file name of the current module. This is the resolved absolute path of the
current module file.
The file name of the current module. This is current module file's absolute path

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an idea, but I think file could be omitted or moved before path, which might be even clearer?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So either current module's absolute path or else current module's absolute file path? It's subtle, but I wonder if that might make someone expect __dirname value instead of __filename if a module is loaded or invoked at the directory level (e.g., node . instead of node index.js).

@Trott

Copy link
Copy Markdown
MemberAuthor

One thing this does not mention explicitly is that . and .. are also resolved. To me, that seems obvious/implied by "file's absolute path" but I'm flagging this here in case others disagree. (The wording being replaced here makes that very easy to miss too, and it hasn't seemed to cause any problems.)

Comment threaddoc/api/modules.md Outdated
@Trott

Copy link
Copy Markdown
MemberAuthor

Trott added a commit to Trott/io.js that referenced this pull request Nov 27, 2018
Make it more explicit that symlinks are resolved in `__filename`.
Refs: nodejs#22602 (comment)
PR-URL: nodejs#24587
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@Trott

Copy link
Copy Markdown
MemberAuthor

Landed in bb04a8b

@TrottTrott closed this Nov 27, 2018
targos pushed a commit that referenced this pull request Nov 27, 2018
Make it more explicit that symlinks are resolved in `__filename`.
Refs: #22602 (comment)
PR-URL: #24587
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
rvagg pushed a commit that referenced this pull request Nov 28, 2018
Make it more explicit that symlinks are resolved in `__filename`.
Refs: #22602 (comment)
PR-URL: #24587
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@BridgeARBridgeAR mentioned this pull request Dec 5, 2018
4 tasks
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
Make it more explicit that symlinks are resolved in `__filename`.
Refs: nodejs#22602 (comment)
PR-URL: nodejs#24587
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
BethGriggs pushed a commit that referenced this pull request Feb 11, 2019
Make it more explicit that symlinks are resolved in `__filename`.
Refs: #22602 (comment)
PR-URL: #24587
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@BethGriggsBethGriggs mentioned this pull request Feb 12, 2019
rvagg pushed a commit that referenced this pull request Feb 28, 2019
Make it more explicit that symlinks are resolved in `__filename`.
Refs: #22602 (comment)
PR-URL: #24587
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@Trott
Trott deleted the resolved branch January 13, 2022 22:50
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docIssues and PRs related to the documentations.moduleIssues and PRs related to the module subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@Trott@nodejs-github-bot@addaleax@cjihrig@vsemozhetbyt@BethGriggs