Add File Association support by default

This commit is contained in:
naman-crabnebula 2024-07-23 04:38:44 +05:30
parent f153e8b0fe
commit 7052d8b365
No known key found for this signature in database
GPG Key ID: 72A9B7243002D463
2 changed files with 8 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"tauri-bundler": "patch:feat"
---
Add support for File Association in Linux by default.

View File

@ -97,6 +97,8 @@ pub fn generate_desktop_file(
data_dir: &Path,
) -> crate::Result<(PathBuf, PathBuf)> {
let bin_name = settings.main_binary_name();
// %F is to enable file association for the application.
let exec_command = format!("{} %F", bin_name);
let desktop_file_name = format!("{bin_name}.desktop");
let path = PathBuf::from("usr/share/applications").join(desktop_file_name);
let dest_path = PathBuf::from("/").join(&path);
@ -159,7 +161,7 @@ pub fn generate_desktop_file(
} else {
None
},
exec: bin_name,
exec: &exec_command,
icon: bin_name,
name: settings.product_name(),
mime_type,