feat: support wildcard pattern matching for executable paths - #63
PrimeBuild-pc merged 3 commits into
Conversation
- Add PathPatternMatcher helper supporting * and ? glob matching with path separator normalization - Update PersistentProcessRuleMatcher and ProcessPowerPlanAssociation to support pattern matching - Add unit tests covering exact matches, glob patterns, versioned AppX paths, and negative matches
PrimeBuild-pc
left a comment
There was a problem hiding this comment.
Thanks for the contribution. The feature is valid and useful for versioned WindowsApps paths. I completed the branch by fixing the compile errors, correcting the forward-slash test pattern, replacing per-match regex evaluation with a bounded wildcard matcher, adding coverage for power-plan associations, and updating it onto main.\n\nVerified locally: Release build, scoped formatting, and 758 tests. CI DevSecOps and CodeQL pass (the first CI run hit an unrelated timing-test flake; its rerun passed).
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Summary
Adds wildcard (
*and?) pattern matching support to executable path rules across persistent process rules and power plan associations.Motivation
Packaged Windows applications (MSIX, AppX, Windows Store apps, e.g. Raycast, Slack, etc.) install into versioned directories under:
When these applications bundle generic child executables (such as
node.exe,python.exe, orffmpeg.exe), users face a dilemma:node) unintentionally targets system-wide runtimes (like developer Node.js / NVM environments or scripts), altering their priority or affinity.string.Equals) breaks every time the application auto-updates, because the version number in the directory path changes.With this change, users can write wildcard patterns such as:
*Raycast*\backend\node.exe*WindowsApps\Raycast.Raycast_*_x64__*\Raycast\backend\node.exeC:\Games\*\bin\game.exeImplementation
PathPatternMatcher.csinThreadPilot.Helpers:/to\) and performs case-insensitive regex pattern matching.PersistentProcessRuleMatcher.csto usePathPatternMatcher.IsPathMatchand avoid callingPath.GetFullPathon wildcard patterns.ProcessPowerPlanAssociation.cs(MatchesProcess) to support pattern matching whenMatchByPathis enabled.PersistentProcessRuleMatcherTests.csvalidating:*Raycast*\backend\node.exe)C:\nvm4w\nodejs\node.exe)?wildcardsType of Change
Validation
Security and Risk Notes
No elevation, security privilege, or credential changes. Matching remains a read-only comparison on process models against user-configured rules. Fast-path keeps non-wildcard evaluation identical in performance.
Checklist