Skip to content

Commit c6f641e

Browse files
committed
1.3.0 release
now relies on regedit package instead of custom reg code because it was broken valve changed the name of the InstallPath registry key to SteamPath. this change has been reflected here so that the script is functional again
1 parent c187ca4 commit c6f641e

File tree

5 files changed

+221
-108
lines changed

5 files changed

+221
-108
lines changed

main.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(async () => {
22
const steamcmd = require('./util/steamcmd')
3-
const reg = require('./util/registry')
3+
const regedit = require('regedit').promisified
44
const progress = require('./util/progress')
55
const fs = require('fs-extra')
66
const enquirer = require('enquirer')
@@ -15,27 +15,28 @@
1515
font: 'Slant2',
1616
horizontalLayout: 'fitted',
1717
verticalLayout: 'fitted'
18-
}) + chalk.blueBright('v1.2.0 stable')))
18+
}) + chalk.blueBright('v1.3.0 stable')))
1919
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`))
2121
progress.start('Verifying steam directory...')
2222

2323
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;
3940
})()
4041

4142
if (!steamIPath) {

0 commit comments

Comments
 (0)