Skip to content

Commit 55541ff

Browse files
committed
basic prompting for steamlibrary/gmod
1 parent 618d320 commit 55541ff

3 files changed

Lines changed: 49 additions & 29 deletions

File tree

main.js

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,47 @@
3838
})()
3939

4040
if (!steamIPath) {
41-
return progress.fail('Steam could not be found on your computer.\nAutomatically closing window in 10 seconds.', 10000)
41+
progress.fail('Failed to find Steam Library installation path...', 0, true)
42+
43+
const steamLibraryResponse = await enquirer.prompt([
44+
{
45+
type: 'input',
46+
name: 'steamlibrary',
47+
message: 'Unable to find Steam Library, please provide it here. (Example: E:/SteamLibrary)'
48+
}
49+
]);
50+
51+
steamIPath = steamLibraryResponse.steamlibrary;
52+
} else {
53+
progress.succeed(`Steam installation directory found: ${steamIPath}`)
4254
}
43-
progress.succeed(`Steam installation directory found: ${steamIPath}`)
44-
const gmodIPath = `${steamIPath}/steamapps/common/GarrysMod/garrysmod`
55+
56+
let gmodIPath = `${steamIPath}/steamapps/common/GarrysMod/garrysmod`
4557
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)
47-
progress.succeed(`Garrys Mod installation directory found: ${gmodIPath}`)
58+
if (!fs.existsSync(gmodIPath)) {
59+
progress.fail('Garrys Mod could not be found in Steam Library.', 0, true)
60+
61+
const gmodResponse = await enquirer.prompt([
62+
{
63+
type: 'input',
64+
name: 'garrysmoddir',
65+
message: 'Unable to find Garrys Mod, please provide it here. (Example: E:/SteamLibrary/steamapps/common/GarrysMod)'
66+
}
67+
]);
68+
69+
gmodIPath = gmodResponse.garrysmoddir
70+
gmodIPath = gmodIPath.replace('\\', '/') + '/garrysmod'
71+
72+
progress.start('Verifying Garrys Mod directory...')
73+
if (!fs.existsSync(gmodIPath)) {
74+
return progress.fail('The provided location does not have Garrys Mod installed. Please try again. Closing in 10 seconds...', 10000)
75+
} else {
76+
progress.succeed(`Garrys Mod installation directory found: ${gmodIPath}`)
77+
}
78+
} else {
79+
progress.succeed(`Garrys Mod installation directory found: ${gmodIPath}`)
80+
}
81+
4882
progress.start('Checking for steamcmd...')
4983
if (!fs.existsSync(appDirectory + '/steam/steamcmd.exe')) {
5084
await (async () => {
@@ -69,6 +103,7 @@
69103
} else {
70104
progress.succeed(`Steamcmd.exe found: ${appDirectory + '/steam/steamcmd.exe'}`)
71105
}
106+
/*
72107
if (fs.existsSync(appDirectory + '/cssource')) {
73108
progress.start(`Found cssource folder. This most likely may have been generated from past usage of the program, and as such is being automatically removed.`)
74109
fs.removeSync(appDirectory + '/cssource')
@@ -146,4 +181,5 @@
146181
progress.succeed(`The Counter-Strike Source textures have been successfully installed into Garrys Mod.\nInstallation path: ${gmodIPath}/addons/css_content`)
147182
progress.log('You may now close this console window.')
148183
})
184+
*/
149185
})()

package-lock.json

Lines changed: 7 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"author": "ITS_N1GH7OWL",
1212
"license": "ISC",
1313
"dependencies": {
14-
"axios": "^0.19.2",
14+
"axios": "^0.21.1",
1515
"chalk": "^4.0.0",
1616
"colors": "^1.4.0",
1717
"enquirer": "^2.3.5",

0 commit comments

Comments
 (0)