dotzuki-engine-script 0.1.1

Boa-based async JavaScript scripting runtime for the dotzuki JRPG engine
Documentation
use std::env;
use std::fs::File;
use std::io::{BufWriter, Write};
use std::path::Path;

fn main() {
    // The `embedded-scripts` embedding used to probe for pokered's map data
    // directory. Since the engine is distributed standalone — games embed their
    // own compiled scenes through their own build scripts (e.g. pokered-data /
    // wuxia-data's build.rs via `compile_dirs` + `register_compiled`) — this
    // crate no longer knows any game's data layout and always emits an empty
    // stub. The feature stays a no-op so consumers can still forward it.
    let out_dir = env::var("OUT_DIR").unwrap();
    let dest_path = Path::new(&out_dir).join("embedded_scripts.rs");
    let mut file = BufWriter::new(File::create(&dest_path).unwrap());
    generate_empty_stub(&mut file);
    file.flush().unwrap();
}

fn generate_empty_stub<W: Write>(writer: &mut W) {
    writeln!(writer, "// Auto-generated by build.rs - DO NOT EDIT").unwrap();
    writeln!(writer).unwrap();
    writeln!(
        writer,
        "pub fn load_embedded_scripts(_loader: &mut crate::loader::ScriptLoader) {{"
    )
    .unwrap();
    writeln!(
        writer,
        "    log::warn!(\"No embedded scripts available\");"
    )
    .unwrap();
    writeln!(writer, "}}").unwrap();
}