From 7801aa8cfdc5c9a61b50a98efb07b592f5d49d7c Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 30 Aug 2024 14:37:56 -0700 Subject: [PATCH] refactor: make is_important function portable for Windows compatibility --- aider/special.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aider/special.py b/aider/special.py index 9be26e28f..c5b88e58b 100644 --- a/aider/special.py +++ b/aider/special.py @@ -190,7 +190,7 @@ def is_important(file_path): dir_name = os.path.dirname(file_path) # Check for GitHub Actions workflow files - if dir_name.endswith(".github/workflows") and file_name.endswith(".yml"): + if os.path.basename(dir_name) == "workflows" and os.path.basename(os.path.dirname(dir_name)) == ".github" and file_name.endswith(".yml"): return True # Check for IDE-specific directories @@ -198,7 +198,7 @@ def is_important(file_path): return True # Check for Kubernetes config files - if "kubernetes" in dir_name.split(os.path.sep) and file_name.endswith(".yaml"): + if "kubernetes" in os.path.normpath(dir_name).split(os.sep) and file_name.endswith(".yaml"): return True # Check for migration directories @@ -206,7 +206,7 @@ def is_important(file_path): return True return file_name in IMPORTANT_FILES or any( - file_path.endswith(f"/{name}") for name in IMPORTANT_FILES + file_path.endswith(os.path.join('', name)) for name in IMPORTANT_FILES )