-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
41 lines (39 loc) · 1.21 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#[cfg(not(feature = "no-blp"))]
use std::{
fs::read_dir,
io::{Error, ErrorKind},
process::Command,
};
use std::io::Result;
fn main() -> Result<()> {
#[cfg(not(feature = "no-blp"))]
{
read_dir("resources")?.try_for_each(|entry| {
let path = entry?.path();
if path.extension().and_then(|s| s.to_str()) != Some("blp") {
return Result::Ok(());
}
let path_out = path.with_extension("ui");
let out = path_out.to_str().ok_or(Error::new(
ErrorKind::InvalidInput,
"Path contains invalid characters",
))?;
let r#in = path.to_str().ok_or(Error::new(
ErrorKind::InvalidInput,
"Path contains invalid characters",
))?;
Command::new("blueprint-compiler")
.args(["compile", "--output", out, r#in])
.spawn()
.expect(r#"Failed to start "blueprint-compiler""#)
.wait()
.map(|_| ())
})?;
}
glib_build_tools::compile_resources(
&["resources"],
"resources/resources.gresource.xml",
"glushkovizer.gresource",
);
Ok(())
}