瀏覽代碼

fix(bundler): ignore duplicated files in resource iter, closes #4126 (#4129)

Lucas Fernandes Nogueira 3 年之前
父節點
當前提交
3e702cf8b1
共有 2 個文件被更改,包括 12 次插入0 次删除
  1. 5 0
      .changes/fix-glob-resource-wix.md
  2. 7 0
      tooling/bundler/src/bundle/windows/msi/wix.rs

+ 5 - 0
.changes/fix-glob-resource-wix.md

@@ -0,0 +1,5 @@
+---
+"tauri-bundler": patch
+---
+
+Fixes processing of resources with glob patterns when there are nested directories on Windows.

+ 7 - 0
tooling/bundler/src/bundle/windows/msi/wix.rs

@@ -799,6 +799,13 @@ fn generate_resource_data(settings: &Settings) -> crate::Result<ResourceMap> {
       .into_string()
       .expect("failed to read resource path");
 
+    // In some glob resource paths like `assets/**/*` a file might appear twice
+    // because the `tauri_utils::resources::ResourcePaths` iterator also reads a directory
+    // when it finds one. So we must check it before processing the file.
+    if added_resources.contains(&resource_path) {
+      continue;
+    }
+
     added_resources.push(resource_path.clone());
 
     let resource_entry = ResourceFile {