From 9573c62bf1dfde501af4bd92854adc335faca68b Mon Sep 17 00:00:00 2001 From: 0neGal Date: Tue, 22 Mar 2022 23:35:22 +0100 Subject: fix: VDF path searching not working on SteamDeck (#97) * added debug messages * more debug logging * even more debug logging * removed debugging and fixed VDF problem maybe? Apparently the libraryfolders.vdf doesn't always come with the same values, sometimes it comes with the contentstatsid variable and other times not, we assumed it always was there, and never checked for it, this caused problems if it wasn't there. This should fix that... --- src/extras/findgame.js | 10 ++++++++-- src/utils.js | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/extras/findgame.js b/src/extras/findgame.js index 42c9b85..cfcb7aa 100644 --- a/src/extras/findgame.js +++ b/src/extras/findgame.js @@ -31,11 +31,17 @@ module.exports = async () => { // Parse read_data data = vdf.parse(data); + let values = Object.values(data["libraryfolders"]); + if (typeof values[values.length - 1] != "object") { + values.pop(1); + } + // `.length - 1` This is because the last value is `contentstatsid` - for (let pathIterator = 0; pathIterator < Object.values(data["libraryfolders"]).length - 1; pathIterator++) { - let data_array = Object.values(data["libraryfolders"][pathIterator]) + for (let i = 0; i < values.length; i++) { + let data_array = Object.values(values[i]) if (fs.existsSync(data_array[0] + "/steamapps/common/Titanfall2/Titanfall2.exe")) { + console.log("Found game in:", data_array[0]) return data_array[0] + "/steamapps/common/Titanfall2"; } } diff --git a/src/utils.js b/src/utils.js index 7c1c22b..57c0289 100644 --- a/src/utils.js +++ b/src/utils.js @@ -769,6 +769,8 @@ setInterval(() => { ipcMain.emit("guigetmods"); }, 1500) +console.log(findgame()) + module.exports = { mods, lang, -- cgit v1.2.3