Skip to content

Commit

Permalink
fix(bundler): don't convert product name to snake case when cross com…
Browse files Browse the repository at this point in the history
…piling (#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
  • Loading branch information
FabianLars committed Apr 18, 2024
1 parent f9638b6 commit 1675e41
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .changes/bundler-cross-uppercase-productname.md
Original file line number Diff line number Diff line change
@@ -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.
26 changes: 17 additions & 9 deletions tooling/cli/src/interface/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 1675e41

Please sign in to comment.