diff --git a/Cargo.lock b/Cargo.lock index f766edf..f99d896 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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" diff --git a/neutauri_runtime/Cargo.toml b/neutauri_runtime/Cargo.toml index c4594a1..9f30ac8 100644 --- a/neutauri_runtime/Cargo.toml +++ b/neutauri_runtime/Cargo.toml @@ -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" diff --git a/neutauri_runtime/build.rs b/neutauri_runtime/build.rs new file mode 100644 index 0000000..4deaec7 --- /dev/null +++ b/neutauri_runtime/build.rs @@ -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() {} diff --git a/neutauri_runtime/src/main.rs b/neutauri_runtime/src/main.rs index 2de7e88..ae4de7f 100644 --- a/neutauri_runtime/src/main.rs +++ b/neutauri_runtime/src/main.rs @@ -35,7 +35,7 @@ fn custom_protocol_uri_to_path>(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); diff --git a/neutauri_runtime/wry.ico b/neutauri_runtime/wry.ico new file mode 100644 index 0000000..efae3d0 Binary files /dev/null and b/neutauri_runtime/wry.ico differ