Files: de92553986e36c8aa555fb0a529a98913b109777 / scripts / check-configuration.js
1235 bytesRaw
1 | |
2 | |
3 | var homedir = require('os').homedir() |
4 | var macPath = homedir + "/Library/Application Support/Mozilla/NativeMessagingHosts/scuttleshell.json" |
5 | var linuxPath = homedir + "/.mozilla/native-messaging-hosts/scuttleshell.json" |
6 | var manifestPath = process.platform === "darwin" ? macPath : linuxPath |
7 | var fs = require("fs") |
8 | |
9 | function check() { |
10 | |
11 | if (process.platform === "win32") { |
12 | console.log("This script does not work on windows") |
13 | process.exit(1) |
14 | } |
15 | |
16 | if (!fs.existsSync(manifestPath)) { |
17 | console.log("[ERROR] App manifest not found at declared location", manifestPath) |
18 | console.log("\nTry: npm run setup\n") |
19 | process.exit(1) |
20 | } |
21 | |
22 | console.log("[INFO] App manifest path location:", manifestPath) |
23 | |
24 | let manifest = JSON.parse(fs.readFileSync(manifestPath)) |
25 | |
26 | let applicationLauncherPath = manifest.path |
27 | |
28 | if (!fs.existsSync(applicationLauncherPath)) { |
29 | console.log("[ERROR] Launcher not found at declared location", applicationLauncherPath) |
30 | console.log("\nTry: npm run setup\n") |
31 | process.exit(1) |
32 | } |
33 | |
34 | console.log("[OK] Configuration appears correct\n[INFO] App located at:", applicationLauncherPath) |
35 | |
36 | process.exit(0) |
37 | |
38 | } |
39 | |
40 | |
41 | module.exports = check |
42 | |
43 | if (require.main === module) { |
44 | var errorLevel = check() |
45 | } |
Built with git-ssb-web