add windows icon

This commit is contained in:
Tim-Paik 2022-02-04 01:08:15 +08:00
parent 4fc4504057
commit a242b1b12d
Signed by: Tim-Paik
GPG Key ID: DC36A050DB42566D
5 changed files with 27 additions and 2 deletions

10
Cargo.lock generated
View File

@ -1045,6 +1045,7 @@ dependencies = [
"bincode",
"brotli",
"serde",
"winres",
"wry",
]
@ -1845,6 +1846,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "winres"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c"
dependencies = [
"toml",
]
[[package]]
name = "wry"
version = "0.12.2"

View File

@ -8,3 +8,6 @@ bincode = "1.3"
brotli = "3.3"
serde = {version = "1.0", features = ["derive"]}
wry = "0.12"
[target.'cfg(windows)'.build-dependencies]
winres = "0.1"

12
neutauri_runtime/build.rs Normal file
View File

@ -0,0 +1,12 @@
#[cfg(windows)]
extern crate winres;
#[cfg(windows)]
fn main() {
let mut res = winres::WindowsResource::new();
res.set_icon("wry.ico");
res.compile().unwrap();
}
#[cfg(unix)]
fn main() {}

View File

@ -35,7 +35,7 @@ fn custom_protocol_uri_to_path<T: Into<String>>(protocol: T, uri: T) -> wry::Res
fn main() -> wry::Result<()> {
let res = match data::load(std::env::current_exe()?.as_path()) {
Ok(data) => data,
Err(_) => data::load("app.neu")?,
Err(_) => data::load("data.neu")?,
};
let event_loop = EventLoop::new();
@ -113,7 +113,7 @@ fn main() -> wry::Result<()> {
),
};
let path = std::env::current_exe()?;
let path = path.file_name().unwrap_or_else(|| "neutauri_app".as_ref());
let path = path.file_stem().unwrap_or_else(|| "neutauri_app".as_ref());
let mut web_context = if cfg!(windows) {
let config_path = std::env::var("APPDATA").unwrap_or_else(|_| ".".into());
let config_path = path::Path::new(&config_path).join(path);

BIN
neutauri_runtime/wry.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB