path matching on windows
This commit is contained in:
parent
62a141ff6c
commit
044cbbe698
1 changed files with 2 additions and 1 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue