Release apps use the GUI subsystem; workers, Git and cmd start with CREATE_NO_WINDOW. Each exe embeds its icon as resource 1, which gpui also loads for the window. Patch 0044: Win32 devices take no client buffer, so tiles and slide layers paint at full size, then copy. ely.xcd gives both schemes one notes colour: Calc rewrote the comment style on each switch and left an undo step. lo-patches.sh keeps LF. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
22 lines
1.0 KiB
Rust
22 lines
1.0 KiB
Rust
//! Each app's build script: its icon as resource 1 on Windows.
|
|
|
|
use std::{env, fs, path::PathBuf};
|
|
|
|
fn main() {
|
|
if env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") {
|
|
return;
|
|
}
|
|
let app = env::var("CARGO_PKG_NAME").expect("cargo names the package");
|
|
let root = PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("cargo names the folder"));
|
|
let icon = root.join("../../assets/icons").join(format!("{app}.ico"));
|
|
let icon = fs::canonicalize(&icon).unwrap_or_else(|error| panic!("{}: {error}", icon.display()));
|
|
println!("cargo:rerun-if-changed={}", icon.display());
|
|
// gpui's window icon is resource 1.
|
|
let rc = PathBuf::from(env::var("OUT_DIR").expect("cargo gives OUT_DIR")).join("icon.rc");
|
|
let path = icon.to_str().expect("a UTF-8 path").trim_start_matches(r"\\?\").replace('\\', "/");
|
|
fs::write(&rc, format!("1 ICON \"{path}\"\n")).expect("the resource script is written");
|
|
embed_resource::compile(&rc, embed_resource::NONE)
|
|
.manifest_optional()
|
|
.expect("the icon resource compiles");
|
|
}
|