Skip to content

Commit

Permalink
feat(bundler): validate wix toolset files, ref #4474 (#4475)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Jun 26, 2022
1 parent 2ca762d commit 956af4f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/validate-wixtools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-bundler": patch
---

Check if `$HOME\AppData\Local\tauri\WixTools` directory has all the required files and redownload WiX if something is missing.
21 changes: 21 additions & 0 deletions tooling/bundler/src/bundle/windows/msi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,23 @@ mod wix;
pub use wix::{MSI_FOLDER_NAME, MSI_UPDATER_FOLDER_NAME};

use crate::Settings;
use log::warn;

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

const WIX_REQUIRED_FILES: &[&str] = &[
"candle.exe",
"candle.exe.config",
"darice.cub",
"light.exe",
"light.exe.config",
"wconsole.dll",
"winterop.dll",
"wix.dll",
"WixUIExtension.dll",
"WixUtilExtension.dll",
];

/// Runs all of the commands to build the MSI installer.
/// Returns a vector of PathBuf that shows where the MSI was created.
pub fn bundle_project(settings: &Settings, updater: bool) -> crate::Result<Vec<PathBuf>> {
Expand All @@ -18,6 +32,13 @@ pub fn bundle_project(settings: &Settings, updater: bool) -> crate::Result<Vec<P

if !wix_path.exists() {
wix::get_and_extract_wix(&wix_path)?;
} else if WIX_REQUIRED_FILES
.iter()
.any(|p| !wix_path.join(p).exists())
{
warn!("WixTools directory is missing some files. Recreating it.");
std::fs::remove_dir_all(&wix_path)?;
wix::get_and_extract_wix(&wix_path)?;
}

wix::build_wix_app_installer(settings, &wix_path, updater)
Expand Down

0 comments on commit 956af4f

Please sign in to comment.