Add feature to disconnect a shortcut (#160)

This commit is contained in:
Philip Kristoffersen
2022-05-27 20:58:22 +02:00
committed by GitHub
parent 835c7ead8d
commit f16646f540
19 changed files with 271 additions and 122 deletions
+8 -4
View File
@@ -1,4 +1,4 @@
use std::path::{PathBuf, Path};
use std::path::{Path, PathBuf};
use steam_shortcuts_util::shortcut::{Shortcut, ShortcutOwned};
@@ -7,14 +7,18 @@ pub(crate) struct Game {
pub(crate) name: String,
pub(crate) icon: String,
pub(crate) id: String,
pub(crate) launcher: PathBuf
pub(crate) launcher: PathBuf,
}
impl From<Game> for ShortcutOwned {
fn from(game: Game) -> Self {
let launch = format!("\"uplay://launch/{}/0\"", game.id);
let start_dir = game.launcher.parent().unwrap_or_else(|| {Path::new("")}).to_string_lossy();
let exe = format!("\"{}\"",game.launcher.to_string_lossy());
let start_dir = game
.launcher
.parent()
.unwrap_or_else(|| Path::new(""))
.to_string_lossy();
let exe = format!("\"{}\"", game.launcher.to_string_lossy());
Shortcut::new("0", &game.name, &exe, &start_dir, &game.icon, "", &launch).to_owned()
}
}