diff options
author | 3top1a <3top1a.official@gmail.com> | 2022-01-23 11:43:28 +0100 |
---|---|---|
committer | 3top1a <3top1a.official@gmail.com> | 2022-01-23 11:43:28 +0100 |
commit | 77c03b45a5dd6861f23043221315c3016b615753 (patch) | |
tree | ec28c6561c7d95c95e803fa093f21a161577155b /src/extras/findgame.js | |
parent | 4f8884ea68c1360a7b0adec2386c60c7dc65c281 (diff) | |
download | Viper-77c03b45a5dd6861f23043221315c3016b615753.tar.gz Viper-77c03b45a5dd6861f23043221315c3016b615753.zip |
Repaired vdf reading
- os nor app was imported
- returned the entire vdf file instead
Diffstat (limited to 'src/extras/findgame.js')
-rw-r--r-- | src/extras/findgame.js | 10 |
1 files changed, 6 insertions, 4 deletions
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; } |