diff options
author | 0neGal <mail@0negal.com> | 2022-01-23 12:26:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-23 12:26:20 +0100 |
commit | 837008b5baf2233c2c5e900e4f55a2ecf52bef1b (patch) | |
tree | ec28c6561c7d95c95e803fa093f21a161577155b /src/extras | |
parent | 4f8884ea68c1360a7b0adec2386c60c7dc65c281 (diff) | |
parent | 77c03b45a5dd6861f23043221315c3016b615753 (diff) | |
download | Viper-837008b5baf2233c2c5e900e4f55a2ecf52bef1b.tar.gz Viper-837008b5baf2233c2c5e900e4f55a2ecf52bef1b.zip |
Merge pull request #54 from 3top1a/main
Diffstat (limited to 'src/extras')
-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; } |