Skip to content

Commit 05088b0

Browse files
authored
feat(bundler): expose {{long_description}} to custom templates (#9494)
* feat(bundler): expose `{{long_description}}` to custom templates closes #9437 * fix linux
1 parent e64b8f1 commit 05088b0

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

.changes/bundler-long_description.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri-bundler": "patch:feat"
3+
---
4+
5+
Expose `{{long_description}}` variable for custom templates.
6+

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub fn copy_icon_files(settings: &Settings, data_dir: &Path) -> crate::Result<Ve
9393
/// path in the package.
9494
pub fn generate_desktop_file(
9595
settings: &Settings,
96-
template_settings: &Option<PathBuf>,
96+
custom_template_path: &Option<PathBuf>,
9797
data_dir: &Path,
9898
) -> crate::Result<(PathBuf, PathBuf)> {
9999
let bin_name = settings.main_binary_name();
@@ -105,7 +105,7 @@ pub fn generate_desktop_file(
105105

106106
let mut handlebars = Handlebars::new();
107107
handlebars.register_escape_fn(handlebars::no_escape);
108-
if let Some(template) = template_settings {
108+
if let Some(template) = custom_template_path {
109109
handlebars
110110
.register_template_string("main.desktop", read_to_string(template)?)
111111
.with_context(|| "Failed to setup custom handlebar template")?;
@@ -123,6 +123,7 @@ pub fn generate_desktop_file(
123123
icon: &'a str,
124124
name: &'a str,
125125
mime_type: Option<String>,
126+
long_description: String,
126127
}
127128

128129
let mut mime_type: Vec<String> = Vec::new();
@@ -162,6 +163,7 @@ pub fn generate_desktop_file(
162163
icon: bin_name,
163164
name: settings.product_name(),
164165
mime_type,
166+
long_description: settings.long_description().unwrap_or_default().to_string(),
165167
},
166168
file,
167169
)?;

tooling/bundler/src/bundle/windows/msi/wix.rs

+4
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,10 @@ pub fn build_wix_app_installer(
518518

519519
data.insert("product_name", to_json(settings.product_name()));
520520
data.insert("version", to_json(app_version));
521+
data.insert(
522+
"long_description",
523+
to_json(settings.long_description().unwrap_or_default()),
524+
);
521525
let bundle_id = settings.bundle_identifier();
522526
let manufacturer = settings
523527
.publisher()

tooling/bundler/src/bundle/windows/nsis.rs

+4
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ fn build_nsis_app_installer(
210210
data.insert("manufacturer", to_json(manufacturer));
211211
data.insert("product_name", to_json(settings.product_name()));
212212
data.insert("short_description", to_json(settings.short_description()));
213+
data.insert(
214+
"long_description",
215+
to_json(settings.long_description().unwrap_or_default()),
216+
);
213217
data.insert("copyright", to_json(settings.copyright_string()));
214218

215219
// Code signing is currently only supported on Windows hosts

0 commit comments

Comments
 (0)