Function steam_shortcuts_util::shortcuts_parser::parse_shortcuts [−][src]
pub fn parse_shortcuts<'a>(
shortcuts_bytes: &'a [u8]
) -> Result<Vec<Shortcut<'a>>, String>
Expand description
Parse bytes to shortcuts, if the bytes are in a format of the shortcuts.vdf file.
Examples
use steam_shortcuts_util::parse_shortcuts;
use steam_shortcuts_util::shortcuts_to_bytes;
fn example() -> Result<(), Box<dyn std::error::Error>> {
// This path should be to your steams shortcuts file
// Usually located at $SteamDirectory/userdata/$SteamUserId/config/shortcuts.vdf
let content = std::fs::read("src/testdata/shortcuts.vdf")?;
let shortcuts = parse_shortcuts(content.as_slice())?;
assert_eq!(shortcuts[0].app_name, "Celeste");
assert_eq!(3, shortcuts[0].tags.len());
Ok(())
}