mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-22 21:30:44 +02:00
fix(deep-link): prevent duplicate ; in .desktop files on Linux (#1357)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
deep-link: patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixed an issue that caused the `deep-link` plugin to generate incorrect `.desktop` files on Linux.
|
||||||
@@ -219,15 +219,15 @@ mod imp {
|
|||||||
|
|
||||||
let target_file = target.join(&file_name);
|
let target_file = target.join(&file_name);
|
||||||
|
|
||||||
let mime_type = format!("x-scheme-handler/{};", _protocol.as_ref());
|
let mime_type = format!("x-scheme-handler/{}", _protocol.as_ref());
|
||||||
|
|
||||||
if let Ok(mut desktop_file) = ini::Ini::load_from_file(&target_file) {
|
if let Ok(mut desktop_file) = ini::Ini::load_from_file(&target_file) {
|
||||||
if let Some(section) = desktop_file.section_mut(Some("Desktop Entry")) {
|
if let Some(section) = desktop_file.section_mut(Some("Desktop Entry")) {
|
||||||
if let Some(mimes) = section.remove("MimeType") {
|
let old_mimes = section.remove("MimeType");
|
||||||
section.append("MimeType", format!("{mimes};{mime_type};"))
|
section.append(
|
||||||
} else {
|
"MimeType",
|
||||||
section.append("MimeType", format!("{mime_type};"))
|
format!("{mime_type};{}", old_mimes.unwrap_or_default()),
|
||||||
}
|
);
|
||||||
desktop_file.write_to_file(&target_file)?;
|
desktop_file.write_to_file(&target_file)?;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user