fix(windows/#3151): Support UNC paths when changing directories #3162
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: Trying to
:cd
into a UNC Path on Windows would failDefect: #3142 moved away from using
string
s to strongly-typed paths (Fp.t
), to help ensure consistent normalization. However, the parsing logic for ingesting astring
->option(Fp.t)
did not handle parsing UNC paths, so the system would treat it as a failed path.Fix: Ideally,
Fp
could handle this out of the box: reasonml/reason-native#262In the meantime, add an 'adapter' layer around
Fp
- when ingesting strings for Windows, first try to see if it is a UNC-style path. If it is, grab the server and share name and store it around anFp
path. Proxy all operations to and from theFp
path.When the
Fp
is converted back to a string, make sure to use backslashes for that type of path.Next steps:
Fp
(after some dependent PRs are in, like fix(fp): Remove Unix and Str dependencies reasonml/reason-native#261)Fixes #3151