-
Notifications
You must be signed in to change notification settings - Fork 10
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
Drive letter on Windows? #34
Comments
Thanks for the information and context!
Wax does not support Windows path prefixes such as drive letters and other volume specifiers by design. For applications like Nushell's
An option like this would only be necessary when a platform-specific file system feature is needed (such as a Windows UNC path in this example). |
This is really a bummer as It would be great if at least UNC paths with forward slashes could be supported. I.e. |
Late to the party, but I'm the most recent maintainer of The idea of manually splitting the pattern and path on the commandline might work for So I'm looking at workarounds in nushell that might salvage the rooted pattern scenario. Here's what I'm playing around with right now:
So a rooted glob like: It means user cannot quote a metacharacter with Interesting to note that the .NET globbing functions strictly require separating the root directory from the pattern: I'm off to code up this workaround in nu and see how it goes... |
Thanks for sharing, @bobhy! I'm really curious to see how this goes and appreciate seeing what you're working on! I have a few thoughts about this. Wax glob expressions are designed to be as portable as possible. Windows path prefixes are fairly complex and definitely not portable, which is one of the main reasons that they are explicitly not supported.
My inkling is that the developers of these APIs wanted to punt on some of the same issues I've thought about that can occur within Windows path prefixes. For example, what happens if a pattern occurs within a prefix? What does
I agree! I'd also like to caution that mass file operations like this are tricky and dangerous. I factored Wax out of Nym, which attempts to do this kind of thing (it's very incomplete; I've been writing various libraries to improve it and haven't looped back to it yet). This is one of the main reasons that variance and exhaustiveness queries exist in Wax. Most users won't care about this at all, but it turns out that these sorts of properties are important for doing this safely and correctly and I've been spending a lot of time refactoring Wax to provide correct (or at least conservative) answers to these queries. IMO, accepting multiple independent patterns like this should probably be avoided in basic commands. One way to do this is to remove globbing support from commands and instead rely solely on pipelines (as I suggested in a referencing Nushell bug). So this example becomes something more like If multiple independent patterns with varying prefixes are a must, then I think preprocessing like this is a reasonable approach. I'd recommend a Nushell syntax that explicitly separates a native path prefix from the pattern, such as |
One thing I've learned from this and the conversation back at nushell/nushell#10498 is that globbing at the command line is different from globbing in "code", and probably needs to be. If you were interested in positioning
|
Hi,
I'm using nushell which relies on this crate for the glob feature.
Unfortunately it fails to resolve windows drive letters, after reading wax's readme I guess it has to do with the
repetition
token?Is there a way to escape these?
Here are a few non working samples (in nu):
nushell/#7125
I'm a bit short on time lately but if you have pointers to solve this I can also propose a PR at some point
Thanks
The text was updated successfully, but these errors were encountered: