Add support for legendary games

This commit is contained in:
Philip Kristoffersen
2021-09-18 09:27:26 +02:00
parent aa4c6304f3
commit de4d6d0973
8 changed files with 164 additions and 51 deletions
+29 -1
View File
@@ -1,5 +1,5 @@
use serde::{Deserialize, Serialize};
use steam_shortcuts_util::{Shortcut, shortcut::ShortcutOwned};
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ManifestItem {
@@ -18,3 +18,31 @@ pub struct ManifestItem {
#[serde(alias = "AppName")]
pub app_name: String,
}
impl From<&ManifestItem> for ShortcutOwned {
fn from(manifest: &ManifestItem) -> Self {
let exe = format!(
"\"{}\\{}\"",
manifest.install_location, manifest.launch_executable
);
let mut start_dir = manifest.install_location.clone();
if !manifest.install_location.starts_with("\"") {
start_dir = format!("\"{}\"", manifest.install_location);
}
let shortcut = Shortcut::new(
0,
manifest.display_name.as_str(),
exe.as_str(),
start_dir.as_str(),
"",
"",
"",
);
let mut owned_shortcut = shortcut.to_owned();
owned_shortcut.tags.push("EGS".to_owned());
owned_shortcut.tags.push("Ready TO Play".to_owned());
owned_shortcut.tags.push("Installed".to_owned());
owned_shortcut
}
}