diff options
author | 0neGal <mail@0negal.com> | 2022-04-01 19:29:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-01 19:29:54 +0200 |
commit | 492228d7c345a552756db4a5e21a3ff5d22360eb (patch) | |
tree | 3d980de462c04dc06d71a939174ed4d7652c9b28 /src/extras | |
parent | 8cf4eb6be61c54f039e6def03200ce6dbcad74eb (diff) | |
parent | 89fa1d955ccb4ac4133079adc9a775dfabe99942 (diff) | |
download | Viper-492228d7c345a552756db4a5e21a3ff5d22360eb.tar.gz Viper-492228d7c345a552756db4a5e21a3ff5d22360eb.zip |
Merge pull request #98 from 0neGal/vdf-flatpak-support
bug: VDF not working on Flatpak Steam
Diffstat (limited to 'src/extras')
-rw-r--r-- | src/extras/findgame.js | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/extras/findgame.js b/src/extras/findgame.js index cfcb7aa..3beca23 100644 --- a/src/extras/findgame.js +++ b/src/extras/findgame.js @@ -43,26 +43,38 @@ module.exports = async () => { 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"; + } else { + console.log("Game not in:", data_array[0]) } } } - let folder = null; + let folders = []; switch (process.platform) { case "win32": - folder = "C:\\Program Files (x86)\\Steam\\steamapps\\libraryfolders.vdf"; + folders = ["C:\\Program Files (x86)\\Steam\\steamapps\\libraryfolders.vdf"]; break case "linux": case "openbsd": case "freebsd": - folder = path.join(app.getPath("home"), "/.steam/steam/steamapps/libraryfolders.vdf"); + let home = app.getPath("home"); + folders = [ + path.join(home, "/.steam/steam/steamapps/libraryfolders.vdf"), + path.join(home, ".var/app/com.valvesoftware.Steam/.steam/steam/steamapps/libraryfolders.vdf"), + path.join(home, ".var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/libraryfolders.vdf") + ] break } - if (fs.existsSync(folder) && folder) { - let data = fs.readFileSync(folder) - let read_vdf = readvdf(data.toString()) - if (read_vdf ) {return read_vdf} + if (folders.length > 0) { + for (let i = 0; i < folders.length; i++) { + if (! fs.existsSync(folders[i])) {continue} + console.log("Searching VDF file at:", folders[i]) + + let data = fs.readFileSync(folders[i]) + let read_vdf = readvdf(data.toString()) + if (read_vdf) {return read_vdf} + } } if (gamepath) { |