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