path matching on windows

This commit is contained in:
maddalax 2024-10-28 12:46:33 -05:00
parent 62a141ff6c
commit 044cbbe698

View file

@ -3,11 +3,12 @@ package dirutil
import ( import (
"fmt" "fmt"
"github.com/bmatcuk/doublestar/v4" "github.com/bmatcuk/doublestar/v4"
"strings"
) )
func matchesAny(patterns []string, path string) bool { func matchesAny(patterns []string, path string) bool {
for _, pattern := range patterns { for _, pattern := range patterns {
matched, err := doublestar.Match(pattern, path) matched, err := doublestar.Match(pattern, strings.ReplaceAll(path, `\`, "/"))
if err != nil { if err != nil {
fmt.Printf("Error matching pattern: %v\n", err) fmt.Printf("Error matching pattern: %v\n", err)
return false return false