浏览代码

fix(cli): append extension to app binary manually on rename (#9491)

fixes #9488
fixes #8848
Fabian-Lars 1 年之前
父节点
当前提交
f9638b6315
共有 2 个文件被更改,包括 9 次插入2 次删除
  1. 6 0
      .changes/cli-rename-app.md
  2. 3 2
      tooling/cli/src/interface/rust/desktop.rs

+ 6 - 0
.changes/cli-rename-app.md

@@ -0,0 +1,6 @@
+---
+'tauri-cli': 'patch:bug'
+'@tauri-apps/cli': 'patch:bug'
+---
+
+Fixed an issue that caused the CLI to rename app binaries incorrectly if the product name contained a `.` which resulted in the bundling step to fail.

+ 3 - 2
tooling/cli/src/interface/rust/desktop.rs

@@ -357,11 +357,12 @@ fn rename_app(
       product_name.into()
     };
 
+    let binary_extension = if target_os == "windows" { ".exe" } else { "" };
+
     let product_path = bin_path
       .parent()
       .unwrap()
-      .join(product_name)
-      .with_extension(bin_path.extension().unwrap_or_default());
+      .join(format!("{product_name}{binary_extension}"));
 
     rename(bin_path, &product_path).with_context(|| {
       format!(