Skip to content

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

Open
@hedwigz

Description

@hedwigz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions