From 2c4796d0636d9d5f2c48e42cc7a5be0b028877d8 Mon Sep 17 00:00:00 2001 From: Yves Zoundi Date: Tue, 28 Jun 2022 20:36:11 -0400 Subject: [PATCH] Restore delete windows executable icon functionality --- entrusted_client/build.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/entrusted_client/build.rs b/entrusted_client/build.rs index a53465c..ef48f50 100644 --- a/entrusted_client/build.rs +++ b/entrusted_client/build.rs @@ -5,22 +5,22 @@ use std::fs; fn main() -> Result<(), Box> { println!("cargo:rerun-if-changed=translations"); - + for entry in fs::read_dir(Path::new("translations"))? { let path = entry?.path(); let input = path.join("LC_MESSAGES").join("messages.po"); if input.exists() { println!("cargo:info={}", format!("Processing translation PO file: {}", &input.display())); - + let output = path.join("LC_MESSAGES").join("messages.mo"); let catalog_ret = po_file::parse(Path::new(&input)); match catalog_ret { - Ok(catalog) => { + Ok(catalog) => { if let Err(ex) = mo_file::write(&catalog, Path::new(&output)) { return Err(format!("Failed to compile MO file for {}.\n{}", &input.display(), ex.to_string()).into()); - } + } }, Err(ex) => { return Err(format!("Failed to parse PO file {}.\n{}", &input.display(), ex.to_string()).into()); @@ -28,6 +28,12 @@ fn main() -> Result<(), Box> { } } } - + + if let Ok(target_sys) = std::env::var("CARGO_CFG_TARGET_OS") { + if target_sys == "windows" { + embed_resource::compile("icon.rc"); + } + } + Ok(()) }