2022-10-31 20:08:25 +00:00
|
|
|
// This [build.rs] is for setting Windows icons.
|
|
|
|
// The icon in [File Explorer] gets set here.
|
|
|
|
// The icon in the taskbar and top of the App window gets
|
|
|
|
// set in [src/main.rs, src/constants.rs] at runtime with
|
|
|
|
// pre-compiled bytes using [include_bytes!()] on the images in [images/].
|
2022-12-10 02:00:33 +00:00
|
|
|
#[cfg(windows)]
|
2022-10-31 20:08:25 +00:00
|
|
|
fn main() -> std::io::Result<()> {
|
2022-12-10 20:35:20 +00:00
|
|
|
static_vcruntime::metabuild();
|
2022-12-10 02:00:33 +00:00
|
|
|
let mut res = winres::WindowsResource::new();
|
2022-12-10 20:35:20 +00:00
|
|
|
// This sets the icon.
|
2022-12-10 02:00:33 +00:00
|
|
|
res.set_icon("images/icons/icon.ico");
|
2022-12-10 20:35:20 +00:00
|
|
|
// This sets the [Run as Administrator] metadata flag for Windows.
|
2023-02-26 16:44:25 +00:00
|
|
|
// Why do I do this?: [https://github.com/hinto-janai/gupax/tree/main/src#why-does-gupax-need-to-be-admin-on-windows]
|
2022-12-10 20:35:20 +00:00
|
|
|
// TL;DR: Because Windows.
|
2022-12-10 02:00:33 +00:00
|
|
|
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>
|
|
|
|
"#);
|
|
|
|
res.compile()
|
2022-10-31 20:08:25 +00:00
|
|
|
}
|
2022-12-10 02:00:33 +00:00
|
|
|
|
|
|
|
#[cfg(unix)]
|
|
|
|
fn main() {}
|