feat(cli.rs): improve error message on app rename, closes #2101 (#2114)

This commit is contained in:
Lucas Fernandes Nogueira 2021-06-28 21:25:18 -03:00 committed by GitHub
parent 8b7ac1ad14
commit 1a41e9f040
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 5 deletions

View File

@ -0,0 +1,5 @@
---
"cli.rs": patch
---
Improve error message when the product name is invalid.

View File

@ -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 {