fixed wix assets path (#3763)

This commit is contained in:
Klemen authored and GitHub committed 2025-02-24 12:08:48 -08:00
1 parent bdeedc13eb
commit eff2e5d18e
1 file changed
+18 -14
+18 -14
View File
@@ -3,6 +3,7 @@ use anyhow::{anyhow, Context};
use path_absolutize::Absolutize; use path_absolutize::Absolutize;
use std::collections::HashMap; use std::collections::HashMap;
use tauri_bundler::{BundleBinary, BundleSettings, PackageSettings, SettingsBuilder}; use tauri_bundler::{BundleBinary, BundleSettings, PackageSettings, SettingsBuilder};
use walkdir::WalkDir;
use super::*; use super::*;
@@ -187,21 +188,24 @@ impl Bundle {
let asset_dir = bundle.build.asset_dir(); let asset_dir = bundle.build.asset_dir();
if asset_dir.exists() { if asset_dir.exists() {
let asset_dir_entries = std::fs::read_dir(&asset_dir) for entry in WalkDir::new(&asset_dir) {
.with_context(|| format!("failed to read asset directory {:?}", asset_dir))?; let entry = entry.unwrap();
for entry in asset_dir_entries.flatten() { let path = entry.path();
let old = entry
.path()
.canonicalize()
.with_context(|| format!("Failed to canonicalize {entry:?}"))?;
let new = PathBuf::from("assets").join(old.file_name().expect("Filename to exist"));
tracing::debug!("Bundled asset: {old:?} -> {new:?}");
bundle_settings if path.is_file() {
.resources_map let old = path
.as_mut() .canonicalize()
.expect("to be set") .with_context(|| format!("Failed to canonicalize {entry:?}"))?;
.insert(old.display().to_string(), new.display().to_string()); let new =
PathBuf::from("assets").join(path.strip_prefix(&asset_dir).unwrap_or(path));
tracing::debug!("Bundled asset: {old:?} -> {new:?}");
bundle_settings
.resources_map
.as_mut()
.expect("to be set")
.insert(old.display().to_string(), new.display().to_string());
}
} }
} }