general: Fix Linux shortcuts

Makes them function even if it's missing the icon.
This commit is contained in:
lat9nq 2021-07-17 04:04:09 -04:00
parent 810ef5fb25
commit 825e9cc1c3
2 changed files with 16 additions and 3 deletions

View File

@ -333,8 +333,8 @@ mod natives {
}; };
path.push(format!("{}.desktop", slugify(name))); // file name path.push(format!("{}.desktop", slugify(name))); // file name
let desktop_file = format!( let desktop_file = format!(
"[Desktop Entry]\nName={}\nExec=\"{}\" {}\nComment={}\nPath={}\n", "[Desktop Entry]\nType=Application\nName={}\nExec=\"{}\" {}\nComment={}\nPath={}\nIcon=yuzu\n",
name, target, args, description, working_dir name, target, args, description, working_dir
); );
let desktop_f = File::create(path); let desktop_f = File::create(path);
let mut desktop_f = match desktop_f { let mut desktop_f = match desktop_f {

View File

@ -13,6 +13,8 @@ use logging::LoggingErrors;
#[cfg(windows)] #[cfg(windows)]
use native::create_desktop_shortcut; use native::create_desktop_shortcut;
#[cfg(target_os = "linux")]
use native::create_shortcut;
pub struct InstallDesktopShortcutTask { pub struct InstallDesktopShortcutTask {
pub name: String, pub name: String,
@ -71,7 +73,6 @@ impl Task for InstallDesktopShortcutTask {
"maintenancetool" "maintenancetool"
}; };
#[cfg(windows)]
for shortcut in package.shortcuts { for shortcut in package.shortcuts {
let tool_path = path.join(platform_extension); let tool_path = path.join(platform_extension);
let tool_path = tool_path let tool_path = tool_path
@ -83,6 +84,7 @@ impl Task for InstallDesktopShortcutTask {
.to_str() .to_str()
.log_expect("Unable to build shortcut metadata (exe)"); .log_expect("Unable to build shortcut metadata (exe)");
#[cfg(windows)]
installed_files.push(create_desktop_shortcut( installed_files.push(create_desktop_shortcut(
&shortcut.name, &shortcut.name,
&shortcut.description, &shortcut.description,
@ -92,6 +94,17 @@ impl Task for InstallDesktopShortcutTask {
&starting_dir, &starting_dir,
exe_path, exe_path,
)?); )?);
#[cfg(target_os = "linux")]
installed_files.push(create_shortcut(
&shortcut.name,
&shortcut.description,
tool_path,
// TODO: Send by list
&format!("--launcher \"{}\"", exe_path),
&starting_dir,
exe_path,
)?);
} }
// Update the installed packages shortcuts information in the database // Update the installed packages shortcuts information in the database