Question: what is the correct approach for matching windows paths
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 595
- Forks
- 93
- PR merge metrics
- No merged PRs in 30d
Description
I want to match the following pattern:
C:\Users\*\path\to\program.exe
I expect it to match with
C:\Users\hedwigz\path\to\program.exe
but shouldn't match with:
C:\Users\hedwigz\another\path\to\program.exe
But feeding this straight to glob pattern does not work as I expected
fn matches_wildcard(&self, path: &str, wildcard: &str) -> bool {
if let Ok(pattern) = Pattern::new(wildcard.to_ascii_lowercase().as_str()) {
pattern.matches(path.to_ascii_lowercase().as_str())
} else {
false
}
}
What is the correct approach here?
Thanks
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the matches_wildcard function and the Pattern::new call shown in the report, then reproduce both Windows path examples against the glob matcher. Determine how the pattern treats separators and intermediate path components; done means the intended match and non-match behavior is established or the needed change is clearly scoped.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100