Yield C++ source files under each target (recursive for directories), skipping build / vendored trees. Vendored files are skipped even when passed explicitly -- an explicit `app/src/ThirdParty/x.h` must not be stripped just because the directory walk was bypassed.
(targets: list[Path])
| 192 | |
| 193 | |
| 194 | def _iter_files(targets: list[Path]) -> Iterable[Path]: |
| 195 | """Yield C++ source files under each target (recursive for directories), |
| 196 | skipping build / vendored trees. Vendored files are skipped even when |
| 197 | passed explicitly -- an explicit `app/src/ThirdParty/x.h` must not be |
| 198 | stripped just because the directory walk was bypassed.""" |
| 199 | for target in targets: |
| 200 | if target.is_file(): |
| 201 | if target.suffix in _CPP_SUFFIXES and not _is_vendored(target): |
| 202 | yield target |
| 203 | continue |
| 204 | for root, dirs, files in os.walk(target): |
| 205 | dirs[:] = [d for d in dirs if d not in _SKIP_DIRS] |
| 206 | for name in files: |
| 207 | cand = Path(root) / name |
| 208 | if name.endswith(_CPP_SUFFIXES) and not _is_vendored(cand): |
| 209 | yield cand |
| 210 | |
| 211 | |
| 212 | def _write_lf(path: Path, text: str) -> None: |