Skip to content

Commit

Permalink
fixup! Fix path filtering on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Oct 2, 2024
1 parent 2e4e6f7 commit 49457de
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sphinx_autobuild/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ def __repr__(self):
f"regex_based={self.regex_based_patterns!r})"
)

def __call__(self, path):
def __call__(self, filename: str, /):
"""Determine if 'path' should be ignored."""
path = Path(path).resolve().as_posix()
normalised_path = Path(filename).resolve().as_posix()
# Any regular pattern matches.
for pattern in self.regular_patterns:
# separators are normalised before creating the IgnoreFilter
if path.startswith(f"{pattern}/"):
if normalised_path.startswith(f"{pattern}/"):
return True
if fnmatch.fnmatch(path, pattern):
if fnmatch.fnmatch(normalised_path, pattern):
return True

# Any regular expression matches.
for regex in self.regex_based_patterns: # NoQA: SIM110
if regex.search(path):
if regex.search(normalised_path):
return True

return False

0 comments on commit 49457de

Please sign in to comment.