mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 14:03:42 +02:00
Add support for legendary games
This commit is contained in:
@@ -9,7 +9,6 @@ pub fn get_egs_manifests() -> Result<Vec<ManifestItem>, Box<dyn Error>> {
|
||||
let manifest_dir_path = get_manifest_dir_path()?;
|
||||
let manifest_dir_result = std::fs::read_dir(&manifest_dir_path);
|
||||
if let Err(err) = manifest_dir_result {
|
||||
//TODO make a new error type here instead
|
||||
println!("Could not find manifest directory: {}", manifest_dir_path);
|
||||
return Result::Err(Box::new(err));
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user