Skip to content

Commit 0843056

Browse files
authored
Merge pull request #1 from zulc22/dependabot/npm_and_yarn/axios-0.21.1
Dependabot/npm and yarn/axios 0.21.1
2 parents 1461353 + d7a08ae commit 0843056

File tree

3 files changed

+602
-33
lines changed

3 files changed

+602
-33
lines changed

main.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
const enquirer = require('enquirer')
77
const figlet = require('figlet')
88
const chalk = require('chalk')
9+
const vdf_parser = require('vdf-parser')
910
const appDirectory = require('path').dirname(process.pkg ? process.execPath : (require.main ? require.main.filename : process.argv[0])).replace(/\\/g, '/')
1011
let i;
1112

@@ -15,7 +16,7 @@
1516
horizontalLayout: 'fitted',
1617
verticalLayout: 'fitted'
1718
}) + chalk.blueBright('v1.1.0 stable')))
18-
console.log(chalk.magenta(`A utility designed to help make installing CSSource textures into Garry\s Mod ${chalk.blue('safe')} while also doing it the ${chalk.blue('legal method')} by utilizing steamcmd.`))
19+
console.log(chalk.magenta(`A utility designed to help make installing CSSource textures into Garry's Mod ${chalk.blue('safe')} while also using the ${chalk.blue('legal method')} by utilizing steamcmd.`))
1920
console.log(chalk.hex('#7289DA')(`Have any questions? Join my discord: https://discord.gg/kb4KREA`))
2021
progress.start('Verifying steam directory...')
2122

@@ -41,9 +42,28 @@
4142
return progress.fail('Steam could not be found on your computer.\nAutomatically closing window in 10 seconds.', 10000)
4243
}
4344
progress.succeed(`Steam installation directory found: ${steamIPath}`)
44-
const gmodIPath = `${steamIPath}/steamapps/common/GarrysMod/garrysmod`
45-
progress.start('Verifying Garrys Mod directory...')
46-
if (!fs.existsSync(gmodIPath)) return progress.fail('Garrys Mod could not be found on your computer.\nAutomatically closing window in 10 seconds.', 10000)
45+
let gmodIPath = await (async () => {
46+
return new Promise(function (resolve) {
47+
if (fs.existsSync(steamIPath + "/steamapps/appmanifest_4000.acf")) {
48+
resolve(steamIPath + "/steamapps/common/GarrysMod")
49+
} else if (fs.existsSync(steamIPath + "/steamapps/libraryfolders.vdf")) {
50+
var libraryfolders_vdf = vdf_parser.parse(fs.readFileSync(steamIPath + "/steamapps/libraryfolders.vdf").toString())
51+
if ("libraryfolders" in libraryfolders_vdf) {
52+
for (e in libraryfolders_vdf["libraryfolders"]) {
53+
var _e = libraryfolders_vdf["libraryfolders"][e]
54+
if ("4000" in _e["apps"]) {
55+
resolve(_e["path"].replace("\\\\", "/") + "/steamapps/common/GarrysMod")
56+
return
57+
}
58+
}
59+
resolve(false)
60+
} else resolve(false)
61+
} else resolve(false)
62+
})
63+
})()
64+
if (!gmodIPath) {
65+
return progress.fail('Garrys Mod could not be found on your computer.\nAutomatically closing window in 10 seconds.', 10000)
66+
}
4767
progress.succeed(`Garrys Mod installation directory found: ${gmodIPath}`)
4868
progress.start('Checking for steamcmd...')
4969
if (!fs.existsSync(appDirectory + '/steam/steamcmd.exe')) {

0 commit comments

Comments
 (0)