2017-11-10 17:28:24 +00:00
|
|
|
use std::process::Command;
|
2018-05-18 08:34:17 +00:00
|
|
|
use std::env;
|
|
|
|
use std::fs::File;
|
|
|
|
use std::path::Path;
|
|
|
|
use std::io::Write;
|
2017-11-08 11:44:55 +00:00
|
|
|
|
|
|
|
fn main() {
|
2017-11-10 17:28:24 +00:00
|
|
|
// Compile Gresource
|
|
|
|
Command::new("glib-compile-resources")
|
|
|
|
.args(&["--generate", "resources.xml"])
|
|
|
|
.current_dir("res")
|
|
|
|
.status()
|
|
|
|
.unwrap();
|
2018-05-18 08:34:17 +00:00
|
|
|
|
|
|
|
// Generating build globals
|
2018-05-18 11:24:25 +00:00
|
|
|
let default_locales = "./fractal-gtk/po".to_string();
|
2018-05-18 08:34:17 +00:00
|
|
|
let out_dir = env::var("OUT_DIR").unwrap();
|
2018-05-18 11:24:25 +00:00
|
|
|
let localedir = env::var("FRACTAL_LOCALEDIR").unwrap_or(default_locales);
|
2018-05-18 08:34:17 +00:00
|
|
|
let dest_path = Path::new(&out_dir).join("build_globals.rs");
|
|
|
|
let mut f = File::create(&dest_path).unwrap();
|
|
|
|
|
|
|
|
let globals = format!("
|
|
|
|
pub static LOCALEDIR: &'static str = \"{}\";
|
|
|
|
",
|
|
|
|
localedir);
|
|
|
|
|
|
|
|
f.write_all(&globals.into_bytes()[..]).unwrap();
|
2017-11-08 11:44:55 +00:00
|
|
|
}
|