diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/extras/findgame.js | 10 | ||||
-rw-r--r-- | src/utils.js | 2 |
2 files changed, 10 insertions, 2 deletions
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, |