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

Improve makeValid/isValid further (on windows) #92

Open
hasufell opened this issue Nov 25, 2021 · 4 comments
Open

Improve makeValid/isValid further (on windows) #92

hasufell opened this issue Nov 25, 2021 · 4 comments

Comments

@hasufell
Copy link
Member

hasufell commented Nov 25, 2021

hasufell/abstract-filepath#10 (comment)

But as an example the file you linked makes an assumption that the only valid absolute filepath on Windows is one that starts with a drive letter. Which is not true.

It also makes an assumption that badElements is invalid for all paths on Windows. Which is also not true. e.g. \.\COM1 is perfectly valid and points to the first COM port.

It makes an attempt to distinguish between the different namespaces. As in, it recognizes \?\ but then makeValid doesn't seem to.

Also related: #56

@hasufell
Copy link
Member Author

@Mistuke

@hasufell hasufell changed the title Improve makeValid/isValid further Improve makeValid/isValid further (on windows) Nov 25, 2021
@hasufell
Copy link
Member Author

hasufell commented Dec 3, 2021

I also noticed this, which I find confusing:

splitDrive "\\\\?\\UNCshared\\file" == ("\\\\?\\","UNCshared\\file")

"\\\\?\\" isn't really a drive... is it?

@Mistuke
Copy link

Mistuke commented Dec 4, 2021

No, technically speaking that path has no drive, but... Is also invalid.

I'm assuming it was supposed to be "\\\\?\\UNC\\shared\\file" since the UNC is required to indicate it's a UNC path.

Not all Paths in Windows have a drive.

"\\?\" isn't really a drive... is it?

Indeed, \\?\ is a marker to tell the win32 api to not process the path but instead send it straight through to the fs driver.

It's in the so called Win32 “namespace". There are other namespaces like the device on \\.\.

Note that because these skip processing from the API layer that you the paths can't contain OS level concept like . and ..

@hasufell
Copy link
Member Author

hasufell commented Dec 4, 2021

@Mistuke I just implemented the lexer that Neil was aiming at, which might make a lot of the internals easier and more robust. Please check out my comment here: #53 (comment)

There's likely stuff missing or incorrect, but I think it's a good start.

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

No branches or pull requests

2 participants