Skip to content
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

Question: what is the correct approach for matching windows paths #159

Open
hedwigz opened this issue Jan 21, 2025 · 0 comments
Open

Question: what is the correct approach for matching windows paths #159

hedwigz opened this issue Jan 21, 2025 · 0 comments

Comments

@hedwigz
Copy link

hedwigz commented Jan 21, 2025

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

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

1 participant