-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.rs
More file actions
28 lines (26 loc) · 731 Bytes
/
Copy pathbuild.rs
File metadata and controls
28 lines (26 loc) · 731 Bytes
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
fn main() {
// Only run on Windows
#[cfg(target_os = "windows")]
{
if let Err(e) = try_set_win_icon() {
println!("cargo:warning=Failed to set Windows icon: {}", e);
}
}
}
#[cfg(target_os = "windows")]
fn try_set_win_icon() -> Result<(), Box<dyn std::error::Error>> {
let icon_path = "assets/icons/app_icon.ico";
if std::path::Path::new(icon_path).exists() {
let mut res = winres::WindowsResource::new();
res.set_icon(icon_path);
res.compile()?;
} else {
println!(
"cargo:warning=Icon file {} not found, skipping resource embed",
icon_path
);
}
Ok(())
}
#[cfg(not(target_os = "windows"))]
fn _foo() {}