|
1 | 1 | (async () => {
|
2 | 2 | const steamcmd = require('./util/steamcmd')
|
3 |
| - const reg = require('./util/registry') |
| 3 | + const regedit = require('regedit').promisified |
4 | 4 | const progress = require('./util/progress')
|
5 | 5 | const fs = require('fs-extra')
|
6 | 6 | const enquirer = require('enquirer')
|
|
15 | 15 | font: 'Slant2',
|
16 | 16 | horizontalLayout: 'fitted',
|
17 | 17 | verticalLayout: 'fitted'
|
18 |
| - }) + chalk.blueBright('v1.2.0 stable'))) |
| 18 | + }) + chalk.blueBright('v1.3.0 stable'))) |
19 | 19 | console.log(chalk.magenta(`A utility designed to make installing CSSource textures into Garry's Mod ${chalk.blue('easy, safe, and legal')}, by scripting SteamCMD.`))
|
20 |
| - console.log(chalk.hex('#7289DA')(`Have any questions? Join my discord: https://discord.gg/UEb6VB2gqu`)) |
| 20 | + console.log(chalk.hex('#7289DA')(`If you have any issues, be sure to file on GitHub: https://github.com/zulc22/CSS-Texture-Installer-Plus/issues`)) |
21 | 21 | progress.start('Verifying steam directory...')
|
22 | 22 |
|
23 | 23 | let steamIPath = await (async () => {
|
24 |
| - return new Promise(function (resolve) { |
25 |
| - reg.list('HKCU\\SOFTWARE\\Valve\\Steam', (registry) => { |
26 |
| - if (!registry) { |
27 |
| - reg.list('HKLM\\SOFTWARE\\Valve\\Steam', (registry) => { |
28 |
| - if (!registry) { |
29 |
| - reg.list('HKLM\\SOFTWARE\\WOW6432Node\\Valve\\Steam', (registry) => { |
30 |
| - if (!registry) resolve(registry) |
31 |
| - else resolve(registry.InstallPath.value) |
32 |
| - }) |
33 |
| - } else resolve(registry.InstallPath.value) |
34 |
| - }) |
35 |
| - |
36 |
| - } else resolve(registry.SteamPath.value) |
37 |
| - }) |
38 |
| - }) |
| 24 | + steam_search_locations = [ |
| 25 | + "HKCU\\SOFTWARE\\Valve\\Steam", |
| 26 | + "HKCU\\SOFTWARE\\WOW6432Node\\Valve\\Steam", |
| 27 | + "HKLM\\SOFTWARE\\Valve\\Steam", |
| 28 | + "HKLM\\SOFTWARE\\WOW6432Node\\Valve\\Steam" |
| 29 | + ]; |
| 30 | + for (const loc of steam_search_locations) { |
| 31 | + try { |
| 32 | + reg = await regedit.list(loc); |
| 33 | + return reg[loc].values['SteamPath'].value; |
| 34 | + break; |
| 35 | + } catch { |
| 36 | + continue; |
| 37 | + } |
| 38 | + } |
| 39 | + return null; |
39 | 40 | })()
|
40 | 41 |
|
41 | 42 | if (!steamIPath) {
|
|
0 commit comments