forked from 1b-agent/fieldcraft-upstream
app: reverse-DNS app id and the Windows executable icon
The window's Wayland app_id / X11 class is io.github.jyviko.fieldcraft, the id the release packages use for the .desktop entry and the macOS bundle (#72). Windows builds embed assets/app-icon/icon.ico in fieldcraft.exe through embed-resource (MIT, a build dependency only). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NmAttHhUZTokgPeEJia8sm
This commit is contained in:
1 parent
8172af67e7
commit
858b6e9dee
4 files changed
+103
No files matched your search
@@ -0,0 +1,20 @@
|
||||
//! Windows builds embed the application icon (assets/app-icon/icon.ico) in `fieldcraft.exe`, so
|
||||
//! Explorer, the taskbar and shortcuts show it. Other targets need nothing here.
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let icon = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR")?).join("../../assets/app-icon/icon.ico");
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rerun-if-changed={}", icon.display());
|
||||
if std::env::var("CARGO_CFG_TARGET_OS")? != "windows" {
|
||||
return Ok(());
|
||||
}
|
||||
let out = PathBuf::from(std::env::var("OUT_DIR")?);
|
||||
let rc = out.join("fieldcraft.rc");
|
||||
std::fs::write(&rc, format!("1 ICON \"{}\"\n", icon.display().to_string().replace('\\', "/")))?;
|
||||
// Missing resource tools are a build error, rather than silently shipping a generic icon.
|
||||
embed_resource::compile_for(&rc, ["fieldcraft"], embed_resource::NONE).manifest_required()?;
|
||||
Ok(())
|
||||
}
|
||||
Reference in new issue
Block a user