Skip to content

Commit

Permalink
win, doc: document per-drive current working dir
Browse files Browse the repository at this point in the history
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 <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
  • Loading branch information
bzoz authored and jasnell committed Jun 7, 2017
1 parent 01278bd commit f47ce01
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ Error: EISDIR: illegal operation on a directory, read
<stack trace.>
```

*Note:* On Windows Node.js follows the concept of per-drive working directory.
This behavior can be observed when using a drive path without a backslash. For
example `fs.readdirSync('c:\\')` can potentially return a different result than
`fs.readdirSync('c:')`. For more information, see
[this MSDN page][MSDN-Rel-Path].

## WHATWG URL object support
<!-- YAML
added: v7.6.0
Expand Down Expand Up @@ -2835,6 +2841,7 @@ The following constants are meant for use with the [`fs.Stats`][] object's
[FS Constants]: #fs_fs_constants_1
[MDN-Date-getTime]: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/getTime
[MDN-Date]: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date
[MSDN-Rel-Path]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247.aspx#fully_qualified_vs._relative_paths
[Readable Stream]: stream.html#stream_class_stream_readable
[Writable Stream]: stream.html#stream_class_stream_writable
[inode]: https://en.wikipedia.org/wiki/Inode
7 changes: 7 additions & 0 deletions doc/api/path.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ path.posix.basename('/tmp/myfile.html');
// Returns: 'myfile.html'
```

*Note:* On Windows Node.js follows the concept of per-drive working directory.
This behavior can be observed when using a drive path without a backslash. For
example `path.resolve('c:\\')` can potentially return a different result than
`path.resolve('c:')`. For more information, see
[this MSDN page][MSDN-Rel-Path].

## path.basename(path[, ext])
<!-- YAML
added: v0.1.25
Expand Down Expand Up @@ -550,3 +556,4 @@ of the `path` methods.
[`path.posix`]: #path_path_posix
[`path.sep`]: #path_path_sep
[`path.win32`]: #path_path_win32
[MSDN-Rel-Path]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247.aspx#fully_qualified_vs._relative_paths

0 comments on commit f47ce01

Please sign in to comment.