Skip to content

Commit 3f039cb

Browse files
authored
fix: keep original productName for .desktop Name field, closes #2295 (#2384)
1 parent 8b2cc26 commit 3f039cb

File tree

14 files changed

+61
-43
lines changed

14 files changed

+61
-43
lines changed

.changes/linux-app-name.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"cli.rs": patch
3+
"tauri-bundler": patch
4+
---
5+
6+
Only convert package name and binary name to kebab-case, keeping the `.desktop` `Name` field with the original configured value.

.changes/product-name-original.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri": patch
3+
"tauri-utils": patch
4+
---
5+
6+
Keep original value on `config > package > productName` on Linux (previously converted to kebab-case).

core/tauri-utils/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,5 @@ html5ever = "0.25"
2222
proc-macro2 = { version = "1.0", optional = true }
2323
quote = { version = "1.0", optional = true }
2424

25-
[target."cfg(target_os = \"linux\")".dependencies]
26-
heck = "0.3"
27-
2825
[features]
2926
build = [ "proc-macro2", "quote" ]

core/tauri-utils/src/lib.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,7 @@ impl PackageInfo {
2727
/// Returns the application package name.
2828
/// On macOS and Windows it's the `name` field, and on Linux it's the `name` in `kebab-case`.
2929
pub fn package_name(&self) -> String {
30-
#[cfg(target_os = "linux")]
31-
{
32-
use heck::KebabCase;
33-
self.name.to_kebab_case()
34-
}
35-
#[cfg(not(target_os = "linux"))]
36-
return self.name.clone();
30+
self.name.clone()
3731
}
3832
}
3933

examples/api/public/build/bundle.js

Lines changed: 2 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/api/public/build/bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tooling/bundler/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ hex = "0.4"
5353
chrono = "0.4"
5454
dirs-next = "2.0"
5555

56+
[target."cfg(target_os = \"linux\")".dependencies]
57+
heck = "0.3"
58+
5659
[lib]
5760
name = "tauri_bundler"
5861
path = "src/lib.rs"

tooling/bundler/src/bundle/linux/debian.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use super::super::common;
2626
use crate::Settings;
2727

2828
use anyhow::Context;
29+
use heck::KebabCase;
2930
use image::{self, png::PngDecoder, GenericImageView, ImageDecoder};
3031
use libflate::gzip;
3132
use std::process::{Command, Stdio};
@@ -251,7 +252,7 @@ fn generate_control_file(
251252
writeln!(
252253
&mut file,
253254
"Package: {}",
254-
str::replace(settings.product_name(), " ", "-").to_ascii_lowercase()
255+
settings.product_name().to_kebab_case().to_ascii_lowercase()
255256
)?;
256257
writeln!(&mut file, "Version: {}", settings.version_string())?;
257258
writeln!(&mut file, "Architecture: {}", arch)?;

tooling/cli.rs/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tooling/cli.rs/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ encode_unicode = "0.3"
5454
[target."cfg(target_os = \"linux\")".dependencies]
5555
heck = "0.3"
5656

57+
[target."cfg(target_os = \"linux\")".build-dependencies]
58+
heck = "0.3"
59+
5760
[build-dependencies]
5861
schemars = "0.8"
5962
serde = { version = "1.0", features = [ "derive" ] }

0 commit comments

Comments
 (0)