use std::process::Command;

fn main() -> std::io::Result<()>
{
   let out_file = std::env::var("OUT_DIR").unwrap();
   let out_file = format!("--target={}/resources", out_file);

   println!("cargo:rerun-if-changed=data");

   let o = Command::new("glib-compile-resources").arg("data/resources.xml")
                                                 .arg(out_file)
                                                 .output()
                                                 .unwrap();

   if !o.status.success() {
      dbg!(o);
      Err(std::io::Error::new(std::io::ErrorKind::Other, "failed to compile resources"))
   } else {
      Ok(())
   }
}

// EOF
