git ssb

1+

mixmix / scuttle-shell



Tree: 05758207d7227e06350b4212f502124c6b062e63

Files: 05758207d7227e06350b4212f502124c6b062e63 / scripts / check-configuration-win.js

1320 bytesRaw
1
2
3var regedit = require('regedit')
4var key = 'HKCU\\Software\\Mozilla\\NativeMessagingHosts\\scuttleshell'
5var fs = require("fs")
6
7function check() {
8
9 if (process.platform !== "win32") {
10 console.log("This script works only on windows")
11 process.exit(1)
12 }
13
14 regedit.list(key, (err, results) => {
15 if (err) {
16 console.log(`[ERROR] Registry key: ${key} doesn't exist\n\nTry: npm run setup-win\n`)
17 process.exit(1)
18 }
19
20 let manifestPath = results[key].values[""].value
21
22 if (!fs.existsSync(manifestPath)) {
23 console.log("[ERROR] App manifest not found at declared location", manifestPath)
24 console.log("\nTry: npm run setup-win\n")
25 process.exit(1)
26 }
27
28 console.log("[INFO] App manifest path location:", manifestPath)
29
30 let manifest = JSON.parse(fs.readFileSync(manifestPath))
31
32 let applicationLauncherPath = manifest.path
33
34 if (!fs.existsSync(applicationLauncherPath)) {
35 console.log("[ERROR] Launcher not found at declared location", applicationLauncherPath)
36 console.log("\nTry: npm run setup-win\n")
37 process.exit(1)
38 }
39
40 console.log("[OK] Configuration appears correct\n[INFO] App located at:", applicationLauncherPath)
41
42 process.exit(0)
43 })
44
45}
46
47
48module.exports = check
49
50if (require.main === module) {
51 var errorLevel = check()
52}

Built with git-ssb-web