Write *content* to *dest*, hash it, and record in *manifest*. Creates parent directories as needed. Writes bytes directly to avoid platform newline translation (CRLF on Windows). Any ``\r\n`` sequences in *content* are normalised to ``\n`` before writing. Returns
(
content: str,
dest: Path,
project_root: Path,
manifest: IntegrationManifest,
)
| 455 | |
| 456 | @staticmethod |
| 457 | def write_file_and_record( |
| 458 | content: str, |
| 459 | dest: Path, |
| 460 | project_root: Path, |
| 461 | manifest: IntegrationManifest, |
| 462 | ) -> Path: |
| 463 | """Write *content* to *dest*, hash it, and record in *manifest*. |
| 464 | |
| 465 | Creates parent directories as needed. Writes bytes directly to |
| 466 | avoid platform newline translation (CRLF on Windows). Any |
| 467 | ``\r\n`` sequences in *content* are normalised to ``\n`` before |
| 468 | writing. Returns *dest*. |
| 469 | """ |
| 470 | dest.parent.mkdir(parents=True, exist_ok=True) |
| 471 | normalized = content.replace("\r\n", "\n") |
| 472 | dest.write_bytes(normalized.encode("utf-8")) |
| 473 | rel = dest.resolve().relative_to(project_root.resolve()) |
| 474 | manifest.record_existing(rel) |
| 475 | return dest |
| 476 | |
| 477 | def integration_scripts_dir(self) -> Path | None: |
| 478 | """Return path to this integration's bundled ``scripts/`` directory. |