Skip to main content

write_files

Function write_files 

Source
pub fn write_files(
    files: &[KtFile],
    kotlin_root: &Path,
) -> Result<Vec<PathBuf>, WriteKotlinError>
Expand description

Render and write every merged file; returns the written paths.

A non-empty kotlin_root must contain the ownership marker. The initial write accepts a missing or empty directory and creates that marker. Subsequent writes stage the complete output beside the root before replacing the marked tree, so stale generated files are removed without deleting caller-owned files or leaving an old tree half-deleted on failure.

The marker’s content is matched ignoring surrounding whitespace and line endings, so a committed marker checked out with CRLF (git autocrlf on Windows) is still recognized.