From cf78d2692263dd532b35994b263f4ddbed863611 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Fri, 26 Aug 2016 20:36:48 -0700 Subject: [PATCH 1/2] doc: clarify that path.isAbsolute on windows accepts / and \ Fixes: https://github.com/nodejs/node/issues/6520 --- doc/api/path.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/api/path.md b/doc/api/path.md index 6617f0e9e76b62..d833a2c694b8ff 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -261,12 +261,18 @@ path.isAbsolute('.') // false On Windows: ```js -path.isAbsolute('//server') // true -path.isAbsolute('C:/foo/..') // true -path.isAbsolute('bar\\baz') // false -path.isAbsolute('.') // false +path.isAbsolute('//server') // true +path.isAbsolute('\\\\server') // true +path.isAbsolute('C:/foo/..') // true +path.isAbsolute('C:\\foo\\..') // true +path.isAbsolute('bar\\baz') // false +path.isAbsolute('bar/baz') // false +path.isAbsolute('.') // false ``` +*Note*: On Windows, the `path.isAbsolute()` method will accept both forward +slash (`/`) and backwards slash (`\`) characters as path delimiters. + A [`TypeError`][] is thrown if `path` is not a string. ## path.join([path[, ...]]) From 08b12f2e35645c5798f440d65774411cc3386724 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 30 Aug 2016 11:22:44 -0700 Subject: [PATCH 2/2] Fix nit --- doc/api/path.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/api/path.md b/doc/api/path.md index d833a2c694b8ff..1067792631a3e7 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -270,9 +270,6 @@ path.isAbsolute('bar/baz') // false path.isAbsolute('.') // false ``` -*Note*: On Windows, the `path.isAbsolute()` method will accept both forward -slash (`/`) and backwards slash (`\`) characters as path delimiters. - A [`TypeError`][] is thrown if `path` is not a string. ## path.join([path[, ...]]) @@ -515,6 +512,10 @@ added: v0.11.15 The `path.win32` property provides access to Windows-specific implementations of the `path` methods. +*Note*: On Windows, both the forward slash (`/`) and backward slash (`\`) +characters are accepted as path delimiters; however, only the backward slash +(`\`) will be used in return values. + [`path.posix`]: #path_path_posix [`path.win32`]: #path_path_win32 [`path.parse()`]: #path_path_parse_path