|
1 | 1 | (async () => { |
2 | 2 | const steamcmd = require('./util/steamcmd') |
3 | | - const regedit = require('regedit').promisified |
| 3 | + const reg = require('native-reg') |
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.3.0 stable'))) |
| 18 | + }) + chalk.blueBright('v1.4.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 | 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 | 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" |
| 25 | + "SOFTWARE\\Valve\\Steam", |
| 26 | + "SOFTWARE\\WOW6432Node\\Valve\\Steam" |
29 | 27 | ]; |
30 | 28 | for (const loc of steam_search_locations) { |
31 | 29 | try { |
32 | | - reg = await regedit.list(loc); |
33 | | - return reg[loc].values['SteamPath'].value; |
34 | | - break; |
| 30 | + steamkey = reg.openKey(reg.HKCU, loc, reg.Access.READ); |
| 31 | + if (!steamkey) steamkey = reg.openKey(reg.HKLM, loc, reg.Access.READ); |
| 32 | + if (!steamkey) continue; |
| 33 | + return reg.getValue(steamkey, null, 'SteamPath'); |
35 | 34 | } catch { |
36 | 35 | continue; |
37 | 36 | } |
|
123 | 122 | if (dat.code === '0x101') { |
124 | 123 | return progress.update(`Commiting Counter-Strike Source dedicated server files: ${Math.ceil(dat.progress)}%`) |
125 | 124 | } |
126 | | - return progress.update('Error: unexpected code. Perhaps try rerunning the program.\nAutomatically closing window in 10 seconds.', 10000) |
| 125 | + // return progress.update('Error: unexpected code. Perhaps try rerunning the program.\nAutomatically closing window in 10 seconds.', 10000) |
127 | 126 | }).then(() => { |
128 | 127 | progress.succeed('Downloaded Counter-Strike Source dedicated server files.') |
129 | 128 | resolve(true) |
|
0 commit comments