learn-hieroglyphs/build.rs

49 lines
1.7 KiB
Rust

use dirs;
use std::process::Command;
fn main() {
let home = dirs::home_dir().unwrap().to_str().unwrap().to_string();
if cfg!(target_os = "windows") {
Command::new("mkdir")
.arg("C:/ProgramData/glib-2.0/schemas/")
.spawn()
.expect("failed to make dir for schemas!");
Command::new("cp")
.arg("resources/org.foxarmy.settings.gschema.xml")
.arg("C:/ProgramData/glib-2.0/schemas/")
.spawn()
.expect("failed to copy schema to dest. dir");
Command::new("glib-compile-schemas")
.arg("C:/ProgramData/glib-2.0/schemas/")
.spawn()
.expect("Could not compile glib schemas. Probably you don't have glib build tools on your system.");
} else {
let path = format!("{}/.local/share/glib-2.0/schemas", &home);
Command::new("mkdir")
.arg("-p")
.arg(&path)
.spawn()
.expect("failed to make dir for schemas!");
Command::new("cp")
.arg("resources/org.foxarmy.settings.gschema.xml")
.arg(&path)
.spawn()
.expect("failed to copy schema to dest. dir");
Command::new("glib-compile-schemas")
.arg("resources")
.spawn()
.expect("Could not compile glib schemas. Probably you don't have glib build tools on your system.");
Command::new("glib-compile-schemas")
.arg(path)
.spawn()
.expect("Could not compile glib schemas. Probably you don't have glib build tools on your system.");
};
glib_build_tools::compile_resources(
&["resources"],
"resources/resources.gresource.xml",
"compiled.gresource",
);
}