From 3d9a79a3fb4d324ac66033cd3e27413eb6331e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9D=A4=E6=98=AF=E7=BA=B1=E9=9B=BE=E9=85=B1=E5=93=9F?= =?UTF-8?q?=EF=BD=9E?= <49941141+Dragon1573@users.noreply.github.com> Date: Thu, 22 Oct 2026 09:59:10 +0000 Subject: [PATCH] fix(windows): patch executable for common-controls-v6 (#8378) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Enhance patch logic, also patch for "example" executables Signed-off-by: ❤是纱雾酱哟~ <49941141+Dragon1573@users.noreply.github.com> --- src-tauri/build.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src-tauri/build.rs b/src-tauri/build.rs index 8cdf2daf5..13df77750 100644 --- a/src-tauri/build.rs +++ b/src-tauri/build.rs @@ -1,10 +1,9 @@ fn main() -> Result<(), Box> { if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") && std::env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc") - && std::env::var_os("CARGO_FEATURE_CLIPPY").is_some() { - // Tauri's resource is linked to the app binary, but not to Rust unit-test harnesses. - // Give mock-context builds their own manifest so tests can resolve TaskDialogIndirect. + // Tauri's resource is linked to the app binary, but not to Rust unit-test harnesses or examples. + // Give non-app targets their own manifest so tests and examples can resolve TaskDialogIndirect. let out_dir = std::env::var_os("OUT_DIR").ok_or_else(|| std::io::Error::other("OUT_DIR is not set"))?; let manifest_path = std::path::PathBuf::from(out_dir).join("windows-test-manifest.xml"); std::fs::write( @@ -25,8 +24,14 @@ fn main() -> Result<(), Box> { "#, )?; - println!("cargo:rustc-link-arg=/MANIFEST:EMBED"); - println!("cargo:rustc-link-arg=/MANIFESTINPUT:{}", manifest_path.display()); + let manifest_display = manifest_path.display(); + if std::env::var_os("CARGO_FEATURE_CLIPPY").is_some() { + println!("cargo:rustc-link-arg=/MANIFEST:EMBED"); + println!("cargo:rustc-link-arg=/MANIFESTINPUT:{manifest_display}"); + } else { + println!("cargo:rustc-link-arg-examples=/MANIFEST:EMBED"); + println!("cargo:rustc-link-arg-examples=/MANIFESTINPUT:{manifest_display}"); + } } #[cfg(feature = "clippy")]