Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fp: Support UNC paths on Windows #262

Open
bryphe opened this issue Feb 18, 2021 · 0 comments
Open

Fp: Support UNC paths on Windows #262

bryphe opened this issue Feb 18, 2021 · 0 comments

Comments

@bryphe
Copy link
Contributor

bryphe commented Feb 18, 2021

Discovered here: onivim/oni2#3151

On Windows, Fp.absoluteCurrentPlatform doesn't handle UNC paths - this is needed for referencing network shares.

Nice set of test cases here: https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#example-ways-to-refer-to-the-same-file

c:\temp\test-file.txt
\\127.0.0.1\c$\temp\test-file.txt
\\LOCALHOST\c$\temp\test-file.txt
\\.\c:\temp\test-file.txt
\\?\c:\temp\test-file.txt
\\.\UNC\LOCALHOST\c$\temp\test-file.txt
\\127.0.0.1\c$\temp\test-file.txt" 
bryphe added a commit to onivim/oni2 that referenced this issue Feb 19, 2021
__Issue:__ Trying to `:cd` into a [UNC Path](https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#unc-paths) on Windows would fail

__Defect:__ #3142 moved away from using `string`s to strongly-typed paths (`Fp.t`), to help ensure consistent normalization. However, the parsing logic for ingesting a `string` -> `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#262 

In 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 an `Fp` path. Proxy all operations to and from the `Fp` path.

When the `Fp` is converted back to a string, make sure to use backslashes for that type of path.

__Next steps:__
- Considering porting fix to `Fp`(after some dependent PRs are in, like reasonml/reason-native#261)

Fixes #3151
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant