From e045fe32c9b0bed954916dc42528e28ee19f75b8 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Wed, 30 Apr 2025 15:21:14 -0300 Subject: [PATCH] fix(bundler): custom sign command failing to sign uninstaller executable (#13334) --- .changes/fix-custom-signer-uninstaller.md | 5 +++++ crates/tauri-bundler/src/bundle/windows/sign.rs | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .changes/fix-custom-signer-uninstaller.md diff --git a/.changes/fix-custom-signer-uninstaller.md b/.changes/fix-custom-signer-uninstaller.md new file mode 100644 index 000000000..f3d1e6a16 --- /dev/null +++ b/.changes/fix-custom-signer-uninstaller.md @@ -0,0 +1,5 @@ +--- +"tauri-bundler": patch:bug +--- + +Fix custom Windows sign command failing to sign app uninstaller if it references relative paths. \ No newline at end of file diff --git a/crates/tauri-bundler/src/bundle/windows/sign.rs b/crates/tauri-bundler/src/bundle/windows/sign.rs index 3c4cd9573..d24b9135b 100644 --- a/crates/tauri-bundler/src/bundle/windows/sign.rs +++ b/crates/tauri-bundler/src/bundle/windows/sign.rs @@ -142,12 +142,21 @@ pub fn sign_command_custom>( ) -> crate::Result { let path = path.as_ref(); + let cwd = std::env::current_dir()?; + let mut cmd = Command::new(&command.cmd); for arg in &command.args { if arg == "%1" { cmd.arg(path); } else { - cmd.arg(arg); + let path = Path::new(arg); + // turn relative paths into absolute paths - so the uninstall command can use them + // since the !uninstfinalize NSIS hook runs in a different directory + if path.exists() && path.is_relative() { + cmd.arg(cwd.join(path)); + } else { + cmd.arg(arg); + } } } Ok(cmd)