Skip to main content

seed_dir

Function seed_dir 

Source
pub fn seed_dir(dir: &Path) -> Result<usize>
Expand description

Write each embedded curated preset into dir, creating dir (and any missing parents) first, but never overwriting a file that already exists — a user’s edits to a seeded preset survive re-seeding. Returns how many files were newly written. Idempotent: a second call on an already-seeded directory writes zero.

Because seeding never clobbers, a curated preset changed in a later release does not replace the copy a user already has on disk (a “refresh curated” affordance is a follow-up, not this function’s job). Errors bubble up as io::Result so the caller can degrade to the embedded defaults rather than crash (NFR 10).