Skip to content

Commit

Permalink
feat(cli.rs): improve error message on app rename, closes #2101 (#2114)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Jun 29, 2021
1 parent 8b7ac1a commit 1a41e9f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changes/cli-error-message.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"cli.rs": patch
---

Improve error message when the product name is invalid.
19 changes: 14 additions & 5 deletions tooling/cli.rs/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,21 @@ impl Build {
if let Some(product_name) = config_.package.product_name.clone() {
let bin_name = app_settings.cargo_package_settings().name.clone();
#[cfg(windows)]
rename(
out_dir.join(format!("{}.exe", bin_name)),
out_dir.join(format!("{}.exe", product_name)),
)?;
let (bin_path, product_path) = {
(
out_dir.join(format!("{}.exe", bin_name)),
out_dir.join(format!("{}.exe", product_name)),
)
};
#[cfg(not(windows))]
rename(out_dir.join(bin_name), out_dir.join(product_name))?;
let (bin_path, product_path) = { (out_dir.join(bin_name), out_dir.join(product_name)) };
rename(&bin_path, &product_path).with_context(|| {
format!(
"failed to rename `{}` to `{}`",
bin_path.display(),
product_path.display(),
)
})?;
}

if config_.tauri.bundle.active {
Expand Down

0 comments on commit 1a41e9f

Please sign in to comment.