diff options
author | 0neGal <mail@0negal.com> | 2022-01-23 21:20:43 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2022-01-23 21:20:43 +0100 |
commit | 1362df77adf25a941cc31d3a82378f6911728f10 (patch) | |
tree | 96edb39c6ae9d41329a30204b92dd24a1b70aba6 /src/extras | |
parent | c92db733034a549e53ebf2c83aaea828ca61697a (diff) | |
download | Viper-1362df77adf25a941cc31d3a82378f6911728f10.tar.gz Viper-1362df77adf25a941cc31d3a82378f6911728f10.zip |
simplify VDF code
Diffstat (limited to 'src/extras')
-rw-r--r-- | src/extras/findgame.js | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/extras/findgame.js b/src/extras/findgame.js index f2d7be1..f7da1c0 100644 --- a/src/extras/findgame.js +++ b/src/extras/findgame.js @@ -41,21 +41,20 @@ module.exports = async () => { } } + let folder = ""; switch (process.platform) { 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") - let read_vdf = readvdf(data.toString()) - if (read_vdf ) {return read_vdf} - } - break; + folder = "C:\\Program Files (x86)\\Steam\\steamapps\\libraryfolders.vdf"; + break case "linux": - if (fs.existsSync(path.join(app.getPath("home"), "/.steam/steam/steamapps/libraryfolders.vdf"))) { - 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; + folder = path.join(app.getPath("home"), "/.steam/steam/steamapps/libraryfolders.vdf"); + break + } + + if (fs.existsSync(folder)) { + let data = fs.readFileSync(folder) + let read_vdf = readvdf(data.toString()) + if (read_vdf ) {return read_vdf} } if (gamepath) { |