From 5172281d7af11300fe79409480d3524020b27556 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 30 Aug 2024 14:40:09 -0700 Subject: [PATCH] refactor: improve portability of is_important function --- aider/special.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/aider/special.py b/aider/special.py index 2885a48d4..a5ccd4757 100644 --- a/aider/special.py +++ b/aider/special.py @@ -209,9 +209,13 @@ def is_important(file_path): if file_name == "migrations" and os.path.isdir(file_path): return True - return file_name in IMPORTANT_FILES or any( - file_path.endswith(os.path.join("", name)) for name in IMPORTANT_FILES - ) + # Check if the file_path matches any of the IMPORTANT_FILES + normalized_path = os.path.normpath(file_path) + for important_file in IMPORTANT_FILES: + if normalized_path.endswith(os.path.normpath(important_file)): + return True + + return False def filter_important_files(file_paths):