Skip to content

Commit 3a0d213

Browse files
authored
Matching in genqlient by Normalizing Paths (#373)
This pull request addresses an issue with the `genqlient` library, which uses the `doublestar` package for path matching. The current implementation does not correctly match paths on Windows systems due to differences in path separators. I've implemented a simple fix by converting Windows-style backslashes (`\`) to forward slashes (`/`) before performing the match, allowing the path matching to work correctly across all platforms. #371 bmatcuk/doublestar#61
1 parent 63893ac commit 3a0d213

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

generate/parse.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ func expandFilenames(globs []string) ([]string, error) {
9191
for _, glob := range globs {
9292
// SplitPattern in case the path is absolute or something; a valid path
9393
// isn't necessarily a valid glob-pattern.
94+
glob = filepath.Clean(glob)
95+
glob = filepath.ToSlash(glob)
9496
base, pattern := doublestar.SplitPattern(glob)
9597
matches, err := doublestar.Glob(os.DirFS(base), pattern, doublestar.WithFilesOnly())
9698
if err != nil {

0 commit comments

Comments
 (0)