Skip to content

Commit 956af4f

Browse files
authored
feat(bundler): validate wix toolset files, ref #4474 (#4475)
1 parent 2ca762d commit 956af4f

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

.changes/validate-wixtools.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-bundler": patch
3+
---
4+
5+
Check if `$HOME\AppData\Local\tauri\WixTools` directory has all the required files and redownload WiX if something is missing.

tooling/bundler/src/bundle/windows/msi.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,23 @@ mod wix;
77
pub use wix::{MSI_FOLDER_NAME, MSI_UPDATER_FOLDER_NAME};
88

99
use crate::Settings;
10+
use log::warn;
1011

1112
use std::{self, path::PathBuf};
1213

14+
const WIX_REQUIRED_FILES: &[&str] = &[
15+
"candle.exe",
16+
"candle.exe.config",
17+
"darice.cub",
18+
"light.exe",
19+
"light.exe.config",
20+
"wconsole.dll",
21+
"winterop.dll",
22+
"wix.dll",
23+
"WixUIExtension.dll",
24+
"WixUtilExtension.dll",
25+
];
26+
1327
/// Runs all of the commands to build the MSI installer.
1428
/// Returns a vector of PathBuf that shows where the MSI was created.
1529
pub fn bundle_project(settings: &Settings, updater: bool) -> crate::Result<Vec<PathBuf>> {
@@ -18,6 +32,13 @@ pub fn bundle_project(settings: &Settings, updater: bool) -> crate::Result<Vec<P
1832

1933
if !wix_path.exists() {
2034
wix::get_and_extract_wix(&wix_path)?;
35+
} else if WIX_REQUIRED_FILES
36+
.iter()
37+
.any(|p| !wix_path.join(p).exists())
38+
{
39+
warn!("WixTools directory is missing some files. Recreating it.");
40+
std::fs::remove_dir_all(&wix_path)?;
41+
wix::get_and_extract_wix(&wix_path)?;
2142
}
2243

2344
wix::build_wix_app_installer(settings, &wix_path, updater)

0 commit comments

Comments
 (0)