-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
1,029 additions
and
601 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
config.override.json5 | ||
libraryfolders.vdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
const fs = require("fs") | ||
const path = require("path") | ||
|
||
const steamPaths = [ | ||
// Default Windows install path | ||
path.join("C:", "Program Files (x86)", "Steam", "steamapps"), | ||
// For development | ||
path.join(__dirname) | ||
] | ||
|
||
module.exports = { | ||
found: [], | ||
search: () => { | ||
let exp = /"\d"\s*"(.*)"/g | ||
let commonPaths = [] | ||
|
||
for (let steamPath of steamPaths) { | ||
let vdfPath = path.join(steamPath, "libraryfolders.vdf") | ||
|
||
commonPaths.push(path.join(steamPath, "common")) | ||
|
||
if (fs.existsSync(vdfPath)) { | ||
let vdfContent = fs.readFileSync(vdfPath, "utf8") | ||
|
||
let appPath = exp.exec(vdfContent) | ||
|
||
while (appPath != null) { | ||
commonPaths.push(path.join(appPath[1], "steamapps", "common")) | ||
appPath = exp.exec(vdfContent) | ||
} | ||
} | ||
} | ||
|
||
for (let commonPath of commonPaths) { | ||
let gamePath = path.join(commonPath, "Counter-Strike Global Offensive") | ||
|
||
if (fs.existsSync(gamePath)) { | ||
console.info("Found installation in", gamePath) | ||
|
||
let configPath = path.join(gamePath, "csgo", "cfg", "gamestate_integration_boltobserv.cfg") | ||
|
||
if (fs.existsSync(configPath)) { | ||
let foundHeader = fs.readFileSync(configPath, "utf8").split("\n")[0] | ||
let ownHeader = fs.readFileSync(path.join(__dirname, "gamestate_integration_boltobserv.cfg"), "utf8").split("\n")[0] | ||
|
||
if (foundHeader != ownHeader) { | ||
module.exports.found.push({ | ||
type: "update", | ||
path: gamePath | ||
}) | ||
} | ||
} | ||
else { | ||
module.exports.found.push({ | ||
type: "install", | ||
path: gamePath | ||
}) | ||
} | ||
} | ||
} | ||
}, | ||
|
||
install: (path) => { | ||
// Need to reimport path because of electron shenanigans | ||
let template = require("path").join(__dirname, "gamestate_integration_boltobserv.cfg") | ||
let dest = require("path").join(path, "csgo", "cfg", "gamestate_integration_boltobserv.cfg") | ||
fs.copyFileSync(template, dest) | ||
|
||
console.info("Installed config file as", dest) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.