use std::io::Result; fn main() -> Result<()> { // Compile protobuf definitions prost_build::compile_protos(&["../proto/guruconnect.proto"], &["../proto/"])?; // Rerun if proto changes println!("cargo:rerun-if-changed=../proto/guruconnect.proto"); // On Windows, embed the manifest for UAC elevation #[cfg(target_os = "windows")] { println!("cargo:rerun-if-changed=guruconnect.manifest"); let mut res = winres::WindowsResource::new(); res.set_manifest_file("guruconnect.manifest"); res.set("ProductName", "GuruConnect Agent"); res.set("FileDescription", "GuruConnect Remote Desktop Agent"); res.set("LegalCopyright", "Copyright (c) AZ Computer Guru"); res.set_icon("guruconnect.ico"); // Optional: add icon if available // Only compile if the manifest exists if std::path::Path::new("guruconnect.manifest").exists() { if let Err(e) = res.compile() { // Don't fail the build if resource compilation fails eprintln!("Warning: Failed to compile Windows resources: {}", e); } } } Ok(()) }