Files: 79077c44d885308d311d2b0337c59abf4d41359f / scripts / check-configuration-win.js
1320 bytesRaw
1 | |
2 | |
3 | var regedit = require('regedit') |
4 | var key = 'HKCU\\Software\\Mozilla\\NativeMessagingHosts\\scuttleshell' |
5 | var fs = require("fs") |
6 | |
7 | function 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 | |
48 | module.exports = check |
49 | |
50 | if (require.main === module) { |
51 | var errorLevel = check() |
52 | } |
Built with git-ssb-web