Skip to content

Commit

Permalink
Restore delete windows executable icon functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
yveszoundi committed Jun 29, 2022
1 parent 180cb75 commit 2c4796d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions entrusted_client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,35 @@ use std::fs;

fn main() -> Result<(), Box<dyn Error>> {
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());
}
}
}
}


if let Ok(target_sys) = std::env::var("CARGO_CFG_TARGET_OS") {
if target_sys == "windows" {
embed_resource::compile("icon.rc");
}
}

Ok(())
}

0 comments on commit 2c4796d

Please sign in to comment.