-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
34 lines (29 loc) · 1.04 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
fn main() -> std::io::Result<()> {
#[cfg(windows)]
{
winresource::WindowsResource::new()
.set_icon("./installers/NSIS/assets/icon.ico")
.compile()?;
let product_version = format!(
"{}.{}.{}.0",
env!("CARGO_PKG_VERSION_MAJOR"),
env!("CARGO_PKG_VERSION_MINOR"),
env!("CARGO_PKG_VERSION_PATCH")
);
// Automatically update the PRODUCT_VERSION in headers.nsh for the NSIS installer
let headers = include_str!("./installers/NSIS/headers.nsh");
let headers: String = headers
.lines()
.map(|line| {
if line.contains("!define PRODUCT_VERSION") {
format!("!define PRODUCT_VERSION \"{}\"", product_version)
} else {
line.to_string()
}
})
.collect::<Vec<String>>()
.join("\n");
std::fs::write("./installers/NSIS/headers.nsh", headers)?;
}
Ok(())
}