-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
30 lines (28 loc) · 820 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
#[cfg(target_os = "windows")]
use winres;
#[cfg(target_os = "windows")]
fn main() {
use std::io::Write;
let mut res = winres::WindowsResource::new();
// we need admin permission to create device
// so we add manifest to auto request permission
res.set_manifest(
r#"
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>"#,
);
match res.compile() {
Err(error) => {
write!(std::io::stderr(), "{}", error).unwrap();
std::process::exit(1);
}
Ok(_) => {}
}
}