vdf icon indicating copy to clipboard operation
vdf copied to clipboard

Backslash escaping is not handled

Open dominik-korsa opened this issue 3 years ago • 1 comments

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

dominik-korsa avatar Apr 18 '22 15:04 dominik-korsa

From the docs:

Allowed Escape sequences are \n, \t, \\, and \".

dominik-korsa avatar Apr 18 '22 16:04 dominik-korsa