fix: correct path for icon windows

This commit is contained in:
Louis-Marie Baer 2024-03-03 09:05:43 +01:00
parent 86d1daee02
commit 9b8e9a26a9

View file

@ -5,16 +5,17 @@
// pre-compiled bytes using [include_bytes!()] on the images in [images/]. // pre-compiled bytes using [include_bytes!()] on the images in [images/].
#[cfg(windows)] #[cfg(windows)]
fn main() -> std::io::Result<()> { fn main() -> std::io::Result<()> {
set_commit_env(); set_commit_env();
static_vcruntime::metabuild(); static_vcruntime::metabuild();
let mut res = winres::WindowsResource::new(); let mut res = winres::WindowsResource::new();
// This sets the icon. // This sets the icon.
res.set_icon("images/icons/icon.ico"); res.set_icon("assets/images/icons/icon.ico");
// This sets the [Run as Administrator] metadata flag for Windows. // This sets the [Run as Administrator] metadata flag for Windows.
// Why do I do this?: [https://github.com/hinto-janai/gupax/tree/main/src#why-does-gupax-need-to-be-admin-on-windows] // Why do I do this?: [https://github.com/hinto-janai/gupax/tree/main/src#why-does-gupax-need-to-be-admin-on-windows]
// TL;DR: Because Windows. // TL;DR: Because Windows.
res.set_manifest(r#" res.set_manifest(
r#"
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security> <security>
@ -24,27 +25,28 @@ fn main() -> std::io::Result<()> {
</security> </security>
</trustInfo> </trustInfo>
</assembly> </assembly>
"#); "#,
res.compile() );
res.compile()
} }
#[cfg(unix)] #[cfg(unix)]
fn main() { fn main() {
set_commit_env(); set_commit_env();
} }
// Set the current git commit to the env var [COMMIT]. // Set the current git commit to the env var [COMMIT].
fn set_commit_env() { fn set_commit_env() {
println!("cargo:rerun-if-changed=.git/refs/heads/"); println!("cargo:rerun-if-changed=.git/refs/heads/");
let output = std::process::Command::new("git") let output = std::process::Command::new("git")
.args(["rev-parse", "HEAD"]) .args(["rev-parse", "HEAD"])
.output() .output()
.unwrap(); .unwrap();
let commit = String::from_utf8(output.stdout).unwrap(); let commit = String::from_utf8(output.stdout).unwrap();
assert!(commit.len() >= 40); assert!(commit.len() >= 40);
println!("cargo:rustc-env=COMMIT={commit}"); println!("cargo:rustc-env=COMMIT={commit}");
} }