-
Notifications
You must be signed in to change notification settings - Fork 44
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
Have VfsPath::join() treat paths more unix-like #42
Comments
Hi, thanks for the suggestions!
|
In general, I think the big advantage of Unix collapsing slashes is that if you're concatenating two strings representing paths, you don't have to remember if the first one ended with a slash or not. Eg: const DIRECTORY: &str = "usr/etc/wobbles/"; // or "usr/etc/wobble"
...
// Did DIRECTORY have a slash??
path.join(DIRECTORY+"/wobble.file") I rely on this behavior a lot in other situations. Granted, in this particular example, you could do FWIW, both Unix and DOS paths treat consecutive slashes this way |
Good points, align VFS behaviour with what OSes are doing sounds like the right thing to do. 👍 Feel free to add PRs regarding these points. |
Example, these are invalid:
path.root().join("..")
- this should just return the rootpath.join("/")
- This should also return the root (this is howPath::join
works)path.join("a///b")
- This should be the same aspath.join("a/b")
(this is also howPath::join
works)Do you think it's a good idea to change the behavior of
VfsPath::join()
? It would certainly be more convenient for what I'm working on.I implemented the first suggestion in #41
Let me know and I can submit more PRs
The text was updated successfully, but these errors were encountered: