-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
39 lines (34 loc) · 979 Bytes
/
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
use std::{
path::PathBuf,
process::Command
};
use which::which;
use embed_manifest::{embed_manifest, new_manifest};
fn find_packfolder() -> Option<PathBuf> {
if let Ok(path) = which("packfolder") {
return Some(path)
}
if let Ok(path) = which("usciter") {
if let Some(parent) = path.parent() {
let mut parent = parent.to_path_buf();
parent.set_file_name("packfolder");
if let Ok(path) = which(parent) {
return Some(path)
}
}
}
None
}
fn main() {
if std::env::var_os("CARGO_CFG_WINDOWS").is_some() {
embed_manifest(new_manifest("Contoso.Sample"))
.expect("unable to embed manifest file");
}
if let Some(packfolder) = find_packfolder() {
Command::new(packfolder)
.args(["./src/ui", "./src/ui.rc", "-binary"])
.status()
.unwrap();
}
println!("cargo:rerun-if-changed=ui");
}