From 4e3dee48c8e932041e3af9a489cbe3fcb9e9bd72 Mon Sep 17 00:00:00 2001 From: Yakov Litvin Date: Tue, 21 Jan 2020 01:35:35 +0300 Subject: [PATCH] doc: add explanatory to path.resolve description Fixes: https://github.com/nodejs/node/issues/25542 PR-URL: https://github.com/nodejs/node/pull/31430 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: David Carlier Reviewed-By: Rich Trott --- doc/api/path.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/path.md b/doc/api/path.md index e4b41605406bb0..477ef2cab09e82 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -477,7 +477,8 @@ an absolute path. The given sequence of paths is processed from right to left, with each subsequent `path` prepended until an absolute path is constructed. For instance, given the sequence of path segments: `/foo`, `/bar`, `baz`, -calling `path.resolve('/foo', '/bar', 'baz')` would return `/bar/baz`. +calling `path.resolve('/foo', '/bar', 'baz')` would return `/bar/baz` +because `'baz'` is not an absolute path but `'/bar' + '/' + 'baz'` is. If after processing all given `path` segments an absolute path has not yet been generated, the current working directory is used.