scripts/setup-win.jsView |
---|
2 | 2 … | var path = require('path') |
3 | 3 … | var regedit = require('regedit') |
4 | 4 … | var fs = require("fs") |
5 | 5 … | var appPath = path.resolve(".\\app.bat") |
| 6 … | +var appManifestTemplateFile = path.resolve(".\\scuttleshell.template.json") |
6 | 7 … | var appManifestFile = path.resolve(".\\scuttleshell.json") |
7 | 8 … | |
| 9 … | + |
8 | 10 … | function setup() { |
9 | 11 … | |
10 | 12 … | if (process.platform !== "win32") { |
11 | 13 … | console.log("This script works only on windows, try npm run setup") |
16 | 18 … | console.log("[ERROR] Application not found at: ", appPath) |
|
17 | 19 … | return 1 |
18 | 20 … | } |
19 | 21 … | |
20 | | - if (!fs.existsSync(appManifestFile)) { |
21 | | - console.log("[ERROR] App manifest not found at: ", appManifestFile) |
| 22 … | + if (!fs.existsSync(appManifestTemplateFile)) { |
| 23 … | + console.log("[ERROR] App manifest not found at: ", appManifestTemplateFile) |
22 | 24 … | return 1 |
23 | 25 … | } |
24 | 26 … | |
25 | | - let manifest = JSON.parse(fs.readFileSync(appManifestFile)) |
| 27 … | + let manifest = JSON.parse(fs.readFileSync(appManifestTemplateFile)) |
26 | 28 … | |
27 | 29 … | let applicationLauncherPath = manifest.path |
28 | 30 … | |
29 | 31 … | if (!fs.existsSync(applicationLauncherPath)) { |
39 | 41 … | |
40 | 42 … | var valuesToPut = { |
41 | 43 … | 'HKCU\\Software\\Mozilla\\NativeMessagingHosts\\scuttleshell': { |
42 | 44 … | 'scuttleshell': { |
43 | | - value: appManifestFile, |
| 45 … | + value: appManifestTemplateFile, |
44 | 46 … | type: 'REG_DEFAULT' |
45 | 47 … | } |
46 | 48 … | } |
47 | 49 … | } |