mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-09-17 11:17:28 +03:00
Add File Association support by default
This commit is contained in:
parent
f153e8b0fe
commit
7052d8b365
5
.changes/bundler-fix-file-association.md
Normal file
5
.changes/bundler-fix-file-association.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"tauri-bundler": "patch:feat"
|
||||||
|
---
|
||||||
|
|
||||||
|
Add support for File Association in Linux by default.
|
@ -97,6 +97,8 @@ pub fn generate_desktop_file(
|
|||||||
data_dir: &Path,
|
data_dir: &Path,
|
||||||
) -> crate::Result<(PathBuf, PathBuf)> {
|
) -> crate::Result<(PathBuf, PathBuf)> {
|
||||||
let bin_name = settings.main_binary_name();
|
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 desktop_file_name = format!("{bin_name}.desktop");
|
||||||
let path = PathBuf::from("usr/share/applications").join(desktop_file_name);
|
let path = PathBuf::from("usr/share/applications").join(desktop_file_name);
|
||||||
let dest_path = PathBuf::from("/").join(&path);
|
let dest_path = PathBuf::from("/").join(&path);
|
||||||
@ -159,7 +161,7 @@ pub fn generate_desktop_file(
|
|||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
exec: bin_name,
|
exec: &exec_command,
|
||||||
icon: bin_name,
|
icon: bin_name,
|
||||||
name: settings.product_name(),
|
name: settings.product_name(),
|
||||||
mime_type,
|
mime_type,
|
||||||
|
Loading…
Reference in New Issue
Block a user