Skip to content

Commit f47ce01

Browse files
bzozjasnell
authored andcommitted
win, doc: document per-drive current working dir
Add note to fs.md and path.md about Windows using per-drive current working directory. Fixes: #9378 PR-URL: #13330 Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
1 parent 01278bd commit f47ce01

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

doc/api/fs.md

+7
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ Error: EISDIR: illegal operation on a directory, read
9494
<stack trace.>
9595
```
9696

97+
*Note:* On Windows Node.js follows the concept of per-drive working directory.
98+
This behavior can be observed when using a drive path without a backslash. For
99+
example `fs.readdirSync('c:\\')` can potentially return a different result than
100+
`fs.readdirSync('c:')`. For more information, see
101+
[this MSDN page][MSDN-Rel-Path].
102+
97103
## WHATWG URL object support
98104
<!-- YAML
99105
added: v7.6.0
@@ -2835,6 +2841,7 @@ The following constants are meant for use with the [`fs.Stats`][] object's
28352841
[FS Constants]: #fs_fs_constants_1
28362842
[MDN-Date-getTime]: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/getTime
28372843
[MDN-Date]: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date
2844+
[MSDN-Rel-Path]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247.aspx#fully_qualified_vs._relative_paths
28382845
[Readable Stream]: stream.html#stream_class_stream_readable
28392846
[Writable Stream]: stream.html#stream_class_stream_writable
28402847
[inode]: https://en.wikipedia.org/wiki/Inode

doc/api/path.md

+7
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ path.posix.basename('/tmp/myfile.html');
5454
// Returns: 'myfile.html'
5555
```
5656

57+
*Note:* On Windows Node.js follows the concept of per-drive working directory.
58+
This behavior can be observed when using a drive path without a backslash. For
59+
example `path.resolve('c:\\')` can potentially return a different result than
60+
`path.resolve('c:')`. For more information, see
61+
[this MSDN page][MSDN-Rel-Path].
62+
5763
## path.basename(path[, ext])
5864
<!-- YAML
5965
added: v0.1.25
@@ -550,3 +556,4 @@ of the `path` methods.
550556
[`path.posix`]: #path_path_posix
551557
[`path.sep`]: #path_path_sep
552558
[`path.win32`]: #path_path_win32
559+
[MSDN-Rel-Path]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247.aspx#fully_qualified_vs._relative_paths

0 commit comments

Comments
 (0)