zenops 0.20.0

Declarative system configuration management for shell config and dotfiles.
//! Build script: ensure `docs/book/book/` exists so `include_dir!` in
//! `src/docs.rs` can read it. The site itself is populated by
//! `just docs-build`; this script just guarantees the directory is there
//! before `cargo build` walks it. If the directory is empty, the
//! resulting `docs` subcommand returns `Error::DocsNotBuilt` instead of
//! serving a broken site.

use std::path::Path;

fn main() {
    let manifest = std::env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR is set by cargo");
    let book = Path::new(&manifest).join("docs/book/book");
    if !book.exists() {
        std::fs::create_dir_all(&book)
            .unwrap_or_else(|e| panic!("create {}: {}", book.display(), e));
    }
    // Re-run when the embedded site changes so the next `cargo build`
    // re-snapshots its contents into the binary.
    println!("cargo:rerun-if-changed=docs/book/book");
}