Przeglądaj źródła

fix(bundler): don't convert product name to snake case when cross compiling (#9481)

* fix(bundler): Don't convert product name to snake case when cross compiling

fixes #9221

* Update bundler-cross-uppercase-productname.md

* Update .changes/bundler-cross-uppercase-productname.md
Fabian-Lars 1 rok temu
rodzic
commit
1675e41f05

+ 6 - 0
.changes/bundler-cross-uppercase-productname.md

@@ -0,0 +1,6 @@
+---
+'tauri-cli': 'patch:bug'
+'@tauri-apps/cli': 'patch:bug'
+---
+
+Fixed an issue with the CLI renaming the main executable in kebab-case when building for Windows on a non-Windows system which caused the bundler step to fail.

+ 17 - 9
tooling/cli/src/interface/rust.rs

@@ -738,10 +738,12 @@ impl AppSettings for RustAppSettings {
             BundleBinary::new(
               format!(
                 "{}{}",
-                config
-                  .package
-                  .binary_name()
-                  .unwrap_or_else(|| binary.name.clone()),
+                (if target_os == "windows" {
+                  config.package.product_name.clone()
+                } else {
+                  config.package.binary_name()
+                })
+                .unwrap_or_else(|| binary.name.clone()),
                 &binary_extension
               ),
               true,
@@ -780,17 +782,23 @@ impl AppSettings for RustAppSettings {
       match binaries.iter_mut().find(|bin| bin.name() == default_run) {
         Some(bin) => {
           if let Some(bin_name) = config.package.binary_name() {
-            bin.set_name(bin_name);
+            if target_os == "windows" {
+              bin.set_name(config.package.product_name.clone().unwrap());
+            } else {
+              bin.set_name(bin_name);
+            }
           }
         }
         None => {
           binaries.push(BundleBinary::new(
             format!(
               "{}{}",
-              config
-                .package
-                .binary_name()
-                .unwrap_or_else(|| default_run.to_string()),
+              (if target_os == "windows" {
+                config.package.product_name.clone()
+              } else {
+                config.package.binary_name()
+              })
+              .unwrap_or_else(|| default_run.to_string()),
               &binary_extension
             ),
             true,