I’ve converted the file libraryfolders.vdf into json using https://github.com/p0358/vdf-parser
Now i’m stuck with something like this:
"libraryfolders": {
"0": {
"path": "D:\\Program Files (x86)\\Steam",
"label": "",
"contentid": -3675068714072690700,
"totalsize": 0,
"update_clean_bytes_tally": 156136761200,
"time_last_update_corruption": 0,
"apps": {
"357720": 1119505844,
"367450": 222650546,
"391540": 163095879,
}
},
"1": {
"path": "C:\\SteamLibrary",
"label": "",
"contentid": 8761260447083160000,
"totalsize": 126696288256,
"update_clean_bytes_tally": 0,
"time_last_update_corruption": 0,
"apps": {
"433340": 1230903210,
}
}
}
I need to loop through all the libraries and get path for gameID.
This is my code so far.
for (let i = 0; i < 999; i++) {
let lib = json.libraryfolders[i];
if (!lib) break;
let path = lib.path;
if (lib.apps.hasOwnProperty('433340')) {
console.log("app found in " + path)
}
}
And my question is: how can I make it more effective? How can I get the number of libs when it’s not in array like brackets []?