vdf
vdf copied to clipboard
Backslash escaping is not handled
The following is snippet is from C:\Program Files (x86)\Steam\steamapps\libraryfolders.vdf:
"libraryfolders"
{
"contentstatsid" "4102335621006428237"
"0"
{
"path" "C:\\Program Files (x86)\\Steam"
// ...
}
"1"
{
"path" "D:\\SteamLibrary"
// ...
}
}
As you can see, there is a path key and it's value escapes the \ character. Your library parses them as
C:\\Program Files (x86)\\Steam - the backslash incorrectly appears twice
If I then do
const result = VDF.parse(/* ... */);
console.log(JSON.stringify(result.libraryfolders.0.path));
"C:\\\\Program Files (x86)\\\\Steam" gets logged