-
Notifications
You must be signed in to change notification settings - Fork 30k
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: make path.relative
stricter
#13714
Conversation
think of this situation: you are current under root path and you do ``` path.relative('../../../../../x', '../../y'); ``` `path.relative` can't fictitious a path for the result, so it's based on current working directory.
doc/api/path.md
Outdated
If `from` and `to` each resolve to the same path (after calling `path.resolve()` | ||
on each), a zero-length string is returned. | ||
The `path.relative()` method returns the relative path from `from` to `to` based | ||
on current working directory. If `from` and `to` each resolve to the same path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/on/on the/
This fixes #13683 |
/ping @refack |
Yes. |
PR-URL: nodejs#13714 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in 6e69421 |
PR-URL: #13714 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #13714 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Throw an error `ERR_UNSUPPORTED_PLATFOMR` when direct use `path.posix.resolve` on Windows or direct use `path.win32.resolve` on *nix. Update docs, list win32 functions do not support direct use on *nix and posix functions do not support direct use on Windows. Update tests, only run current platform type test. Fixes: nodejs#13683 Refs: nodejs#13714
PR-URL: #13714 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
I.ve backported to v6.x. If it shouldn't have been backported let me know and I'll rebase it out |
think of this situation: you are current under root path and you do
path.relative
can't fictitious a path for the result, so it's basedon current working directory.
Checklist
Affected core subsystem(s)
doc, path