-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathregedit.js
46 lines (37 loc) · 1.1 KB
/
regedit.js
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
42
43
44
45
46
const { app } = require('electron');
const Q = require('q')
const debug = require('./debug')
function Regedit() {
}
Regedit.progIds = []
Regedit.add = function(progid) {
Regedit.progIds.push(progid)
}
Regedit.installAll = function() {
return Q.all(Regedit.progIds.map(progId => progId.install()))
}
Regedit.uninstallAll = function() {
return Q.all(Regedit.progIds.map(progId => progId.uninstall()))
}
Regedit.squirrelStartupEvent = function() {
if (process.platform !== 'win32') {
return false;
}
var squirrelCommand = process.argv[1];
switch (squirrelCommand) {
case '--squirrel-install':
case '--squirrel-updated':
debug('Squirrel install/update')
Regedit.installAll().finally(() => app.quit())
return true;
case '--squirrel-uninstall':
debug('Squirrel uninstall')
Regedit.uninstallAll().finally(() => app.quit())
return true;
debug('Squirrel obsolete')
case '--squirrel-obsolete':
app.quit();
return true;
}
}
module.exports = Regedit