Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: clarify symlink resolution for __filename #24587

Closed
wants to merge 2 commits into from

Conversation

Trott
Copy link
Member

@Trott Trott commented Nov 24, 2018

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 nodejs-github-bot added doc Issues and PRs related to the documentations. module Issues and PRs related to the module subsystem. labels Nov 24, 2018
@@ -491,8 +491,8 @@ added: v0.0.1

* {string}

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
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
Member Author

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
Member Author

Trott commented Nov 24, 2018

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.)

doc/api/modules.md Outdated Show resolved Hide resolved
@Trott
Copy link
Member Author

Trott commented Nov 24, 2018

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 <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@Trott
Copy link
Member Author

Trott commented Nov 27, 2018

Landed in bb04a8b

@Trott Trott 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 <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
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 <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@BridgeAR BridgeAR 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 <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
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 <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@BethGriggs BethGriggs 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 <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@Trott Trott deleted the resolved branch January 13, 2022 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. module Issues and PRs related to the module subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants