win, fs: fix realpath behavior on substed drives
Checklist
-
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passes -
benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
fs, win
Description of change
Work in progress for issues related to new realpath implementation (https://github.com/nodejs/node/issues/7175).
Before v6 on drives created with subst and network mapped drives realpath used to return filename on the mapped drive. With v6 (https://github.com/nodejs/node/commit/b488b19eaf2b2e7a3ca5eccd2445e245847a5f76) it now returns filename on the original device or on the network share. This restores the old behavior by:
- Restoring old javascript implementation (separate commit just for reviewing here, can be squashed with the next)
- Using it when path returned by new implementation is on a different device than the original path
This PR addresses only issues related to the filename resolved being different on v6 and v4 (e.g. https://github.com/nodejs/node/issues/7294). There are other issues, for example related to permissions on Windows like https://github.com/nodejs/node/issues/7192 and other on Linux as described in https://github.com/nodejs/node/issues/7175. Some of those are to be addressed in different patch (comment).
@trevnorris this fixes some of the Windows issues. Can you review to make sure it's compatible with your changes?