Function steam_shortcuts_util::shortcuts_writer::shortcuts_to_bytes
source · [−]Expand description
Serializes shortcuts to bytes, in a format that Steam will accept.
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())?;
let shortcut_bytes_vec = shortcuts_to_bytes(&shortcuts);
assert_eq!(shortcut_bytes_vec, content);
Ok(())
}