fix(bundler/nsis): Include WebView2Loader.dll if found to match msi (#12324)

* fix(bundler/nsis): Include WebView2Loader.dll if found to match msi behavior

* Update fix-nsis-webviewloaderdll.md

* only include dll in gnu builds
This commit is contained in:
Fabian-Lars
2025-01-17 16:12:58 +01:00
committed by GitHub
parent d2c8f0eb5c
commit 07ccdc499c
2 changed files with 19 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
tauri-bundler: 'patch:bug'
---
Fixed an issue leading to NSIS based installers to not contain the `WebView2Loader.dll` file when targetting `windows-gnu`.

View File

@@ -595,10 +595,24 @@ fn association_description(
type ResourcesMap = BTreeMap<PathBuf, (PathBuf, PathBuf)>;
fn generate_resource_data(settings: &Settings) -> crate::Result<ResourcesMap> {
let mut resources = ResourcesMap::new();
let cwd = std::env::current_dir()?;
let mut added_resources = Vec::new();
// Adding WebViewer2Loader.dll in case windows-gnu toolchain is used
if settings.target().ends_with("-gnu") {
let loader_path =
dunce::simplified(&settings.project_out_directory().join("WebView2Loader.dll")).to_path_buf();
if loader_path.exists() {
added_resources.push(loader_path.clone());
resources.insert(
loader_path,
(PathBuf::new(), PathBuf::from("WebView2Loader.dll")),
);
}
}
for resource in settings.resource_files().iter() {
let resource = resource?;