From 77c03b45a5dd6861f23043221315c3016b615753 Mon Sep 17 00:00:00 2001 From: 3top1a <3top1a.official@gmail.com> Date: Sun, 23 Jan 2022 11:43:28 +0100 Subject: Repaired vdf reading - os nor app was imported - returned the entire vdf file instead --- src/extras/findgame.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/extras') diff --git a/src/extras/findgame.js b/src/extras/findgame.js index 029914a..426d2e3 100644 --- a/src/extras/findgame.js +++ b/src/extras/findgame.js @@ -1,6 +1,7 @@ const fs = require("fs"); const path = require("path"); const vdf = require("simple-vdf"); +const { app } = require("electron"); const util = require("util"); const exec = util.promisify(require("child_process").exec); @@ -30,7 +31,6 @@ module.exports = () => { // Parse read_data data = vdf.parse(data); - //data['libraryfolders'] // `.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]) @@ -45,13 +45,15 @@ module.exports = () => { case "win32": if (fs.existsSync("C:\\Program Files (x86)\\Steam\\steamapps\\libraryfolders.vdf")) { let data = fs.readFileSync("C:\\Program Files (x86)\\Steam\\steamapps\\libraryfolders.vdf") - if (readvdf(data.toString())) {return data.toString()} + let read_vdf = readvdf(data.toString()) + if (read_vdf ) {return read_vdf} } break; case "linux": if (fs.existsSync(path.join(app.getPath("home"), "/.steam/steam/steamapps/libraryfolders.vdf"))) { - let data = fs.readFileSync(os.homedir() + "/.steam/steam/steamapps/libraryfolders.vdf") - if (readvdf(data.toString())) {return data.toString()} + let data = fs.readFileSync(path.join(app.getPath("home"), "/.steam/steam/steamapps/libraryfolders.vdf")) + let read_vdf = readvdf(data.toString()) + if (read_vdf ) {return read_vdf} } break; } -- cgit v1.2.3