diff --git a/duplicate_files_in_folders/file_manager.py b/duplicate_files_in_folders/file_manager.py index ee777d0..c8670ef 100644 --- a/duplicate_files_in_folders/file_manager.py +++ b/duplicate_files_in_folders/file_manager.py @@ -99,8 +99,11 @@ def is_allowed_path(self, path: str | Path) -> bool: if not self.allowed_dirs: return True # If allowed_dirs is an empty set, all paths are allowed + # resolve all path parents + path_parents = [p.resolve() for p in path.parents] + # True if the path is in any of the allowed directories - return any(path == allowed_dir or allowed_dir in path.parents for allowed_dir in self.allowed_dirs) + return any(path == allowed_dir or allowed_dir in path_parents for allowed_dir in self.allowed_dirs) def move_file(self, src: str, dst: str) -> bool: """