Find all C++ source and header files, excluding specified directories.
(root_dir: Path, exclude_dirs: Set[str])
| 15 | |
| 16 | |
| 17 | def find_cpp_files(root_dir: Path, exclude_dirs: Set[str]) -> List[Path]: |
| 18 | """Find all C++ source and header files, excluding specified directories.""" |
| 19 | cpp_extensions = {'.cpp', '.h', '.hpp', '.cc', '.cxx', '.ino'} |
| 20 | cpp_files: List[Path] = [] |
| 21 | |
| 22 | for ext in cpp_extensions: |
| 23 | for file_path in root_dir.rglob(f'*{ext}'): |
| 24 | # Check if any parent directory should be excluded |
| 25 | if any(excluded in file_path.parts for excluded in exclude_dirs): |
| 26 | continue |
| 27 | cpp_files.append(file_path) |
| 28 | |
| 29 | return cpp_files |
| 30 | |
| 31 | |
| 32 | def check_relative_includes(file_path: Path) -> List[Tuple[int, str]]: |