Skip to content

glob does not accept non-unicode patterns #58

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

Closed
droundy opened this issue Apr 16, 2017 · 4 comments
Closed

glob does not accept non-unicode patterns #58

droundy opened this issue Apr 16, 2017 · 4 comments

Comments

@droundy
Copy link

droundy commented Apr 16, 2017

The str input of glob precludes its use with user-defined patterns that may be non-unicode. The package seems to strongly reject the idea that there might be other filenames out there that might need to be matched against. Perhaps there should be a separate package for globbing with OsStr?

@BurntSushi
Copy link
Member

@droundy I think this might be a dupe of #23?

The globset crate supports matching non-UTF-8 file paths (e.g., * can match the byte \xFF), but it doesn't support providing non-UTF-8 globs themselves. However, since that crate is built on regex, it shouldn't be that hard to graft support for it into globset proper without touching the matching internals.

@droundy
Copy link
Author

droundy commented Apr 16, 2017

I don't think it's a dupe of #23, since this would be about creating a glob with non-utf8 content, e.g. if I wanted to enable user provided globs, git does with .gitignore.

@BurntSushi
Copy link
Member

@droundy #23 mentions that though...

Not only are its patterns restricted to strings

glob() needs to accept both strings and byte-vectors. It can do this using std::path::BytesContainer

glob() needs to process its pattern as a byte vector instead of a string

@droundy
Copy link
Author

droundy commented Apr 16, 2017

Ah, I had been tricked be the title. Yes, this is a dupe.

@droundy droundy closed this as completed Apr 16, 2017
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

2 participants