From d20ae535eb3f50580a69fa737bc51ed736d9873e Mon Sep 17 00:00:00 2001 From: Igor Klopov Date: Sun, 27 Mar 2016 20:12:35 +0300 Subject: [PATCH 1/2] doc: path.resolve ignores zero-length strings https://github.com/nodejs/node/blob/master/lib/path.js#L187 https://github.com/nodejs/node/blob/master/lib/path.js#L1189 --- doc/api/path.markdown | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/api/path.markdown b/doc/api/path.markdown index 3711dd42a1279c..22cb97f237b0ef 100644 --- a/doc/api/path.markdown +++ b/doc/api/path.markdown @@ -316,9 +316,6 @@ path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif') // '/home/myself/node/wwwroot/static_files/gif/image.gif' ``` -*Note:* If the arguments to `resolve` have zero-length strings then the current - working directory will be used instead of them. - ## path.sep The platform-specific file separator. `'\\'` or `'/'`. From 1779536ab2399099faf3a9309c4449b40efad233 Mon Sep 17 00:00:00 2001 From: Igor Klopov Date: Mon, 28 Mar 2016 06:30:32 +0300 Subject: [PATCH 2/2] Empty strings are ignored from arguments --- doc/api/path.markdown | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/path.markdown b/doc/api/path.markdown index 22cb97f237b0ef..75129a06b22af6 100644 --- a/doc/api/path.markdown +++ b/doc/api/path.markdown @@ -281,7 +281,8 @@ If `to` isn't already absolute `from` arguments are prepended in right to left order, until an absolute path is found. If after using all `from` paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path -gets resolved to the root directory. +gets resolved to the root directory. Empty string `from` arguments are +ignored. Another way to think of it is as a sequence of `cd` commands in a shell.