-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
19 lines (17 loc) · 701 Bytes
/
build.rs
File metadata and controls
19 lines (17 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#[cfg(windows)]
fn main() {
let icon_path = std::path::Path::new(&std::env::var("OUT_DIR").unwrap()).join("icon.ico");
println!("cargo:rerun-if-changed=resources/icon.png");
let mut icon_dir = ico::IconDir::new(ico::ResourceType::Icon);
let file = std::fs::File::open("resources/icon.png").unwrap();
let image = ico::IconImage::read_png(file).unwrap();
icon_dir.add_entry(ico::IconDirEntry::encode(&image).unwrap());
icon_dir
.write(std::fs::File::create(&icon_path).unwrap())
.unwrap();
let mut res = tauri_winres::WindowsResource::new();
res.set_icon(icon_path.to_str().unwrap());
res.compile().unwrap();
}
#[cfg(not(windows))]
fn main() {}