-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheck-configuration-win.js
More file actions
41 lines (29 loc) · 1.21 KB
/
Copy pathcheck-configuration-win.js
File metadata and controls
41 lines (29 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
if (process.platform !== "win32") {
console.log("This script works only on windows");
process.exit(1);
}
var regedit = require('regedit');
var key = 'HKCU\\Software\\Mozilla\\NativeMessagingHosts\\sbot_native_app';
var fs = require("fs");
regedit.list(key, (err, results) => {
if (err) {
console.log(`[ERROR] Registry key: ${key} doesn't exist\n\nTry: npm run setup-win\n`);
process.exit(1);
}
let manifestPath = results[key].values[""].value;
if (!fs.existsSync(manifestPath)) {
console.log("[ERROR] App manifest not found at declared location", manifestPath);
console.log("\nTry: npm run setup-win\n");
process.exit(1);
}
console.log("[INFO] App manifest path location:", manifestPath);
let manifest = JSON.parse(fs.readFileSync(manifestPath));
let applicationLauncherPath = manifest.path;
if (!fs.existsSync(applicationLauncherPath)) {
console.log("[ERROR] Launcher not found at declared location", applicationLauncherPath);
console.log("\nTry: npm run setup-win\n");
process.exit(1);
}
console.log("[OK] Configuration appears correct\n[INFO] App located at:", applicationLauncherPath);
process.exit(0);
});