Don't completely skip files whose basenames aren't UTF-8#21
Merged
cgwalters merged 1 commit intocoreos:mainfrom Feb 3, 2023
Merged
Don't completely skip files whose basenames aren't UTF-8#21cgwalters merged 1 commit intocoreos:mainfrom
cgwalters merged 1 commit intocoreos:mainfrom
Conversation
dacf9c3 to
d3d99f2
Compare
It's not as beautiful as it could be if Rust had string manipulation of
OsStr but it's still zero-alloc in the vast majority of cases
API change: scan() -> BTreeMap<String, PathBuf>
to
scan() -> BTreeMap<OsString, PathBuf>
Collaborator
Author
|
And so is this |
cgwalters
approved these changes
Feb 3, 2023
|
|
||
| // If hidden files not allowed, ignore dotfiles. | ||
| if ignore_dotfiles && fname.starts_with('.') { | ||
| // Rust RFC 900 &c.: there's no way to check if a Path/OsStr starts with a prefix; |
Member
There was a problem hiding this comment.
We can on Unix at least just compare the first bytes using https://doc.rust-lang.org/std/os/unix/ffi/trait.OsStrExt.html#tymethod.as_bytes, i.e. under some #cfg[(unix)] or so. I'd honestly be a bit surprised if we ever had users on non-Unix platforms (but, I wouldn't say we should gratuitously not compile there - at least with Rust it's ergonomic to do conditional compilation and most high level abstractions peel away at compile time too).
Collaborator
Author
There was a problem hiding this comment.
I considered this, but nothing else in the crate uses a system-specific API, so I went with this which decays graciously I think.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's not as beautiful as it could be if Rust had string manipulation of
OsStr but it's still zero-alloc in the vast majority of cases
API change:
scan() -> BTreeMap<String, PathBuf>toscan() -> BTreeMap<OsString, PathBuf>Draft because it's on top of #20, patch 2 is the interesting one