diff options
author | 0neGal <mail@0negal.com> | 2022-03-22 23:35:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-22 23:35:22 +0100 |
commit | 9573c62bf1dfde501af4bd92854adc335faca68b (patch) | |
tree | 849e824376543a16490e48cca0625c84628f81f9 /src/extras | |
parent | 30358b9c8b30bf10ff62e32e655e37cc15d4dcdb (diff) | |
download | Viper-9573c62bf1dfde501af4bd92854adc335faca68b.tar.gz Viper-9573c62bf1dfde501af4bd92854adc335faca68b.zip |
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...
Diffstat (limited to 'src/extras')
-rw-r--r-- | src/extras/findgame.js | 10 |
1 files changed, 8 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"; } } |