Merge pull request #296 from Razzeee/update-fix-autolaunch
Make sure our auto launch link is up do date
This commit is contained in:
13
src/main.js
13
src/main.js
@@ -17,17 +17,28 @@ process.on('uncaughtException', (error) => {
|
|||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
var cmd = process.argv[1];
|
var cmd = process.argv[1];
|
||||||
if (cmd === '--squirrel-uninstall') {
|
|
||||||
var AutoLaunch = require('auto-launch');
|
var AutoLaunch = require('auto-launch');
|
||||||
var appLauncher = new AutoLaunch({
|
var appLauncher = new AutoLaunch({
|
||||||
name: 'Mattermost',
|
name: 'Mattermost',
|
||||||
isHidden: true
|
isHidden: true
|
||||||
});
|
});
|
||||||
|
if (cmd === '--squirrel-uninstall') {
|
||||||
|
// If we're uninstalling, make sure we also delete our auto launch registry key
|
||||||
appLauncher.isEnabled().then(function(enabled) {
|
appLauncher.isEnabled().then(function(enabled) {
|
||||||
if (enabled)
|
if (enabled)
|
||||||
appLauncher.disable();
|
appLauncher.disable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else if (cmd === '--squirrel-install' || cmd === '--squirrel-updated') {
|
||||||
|
// If we're updating and already have an registry entry for auto launch, make sure to update the path
|
||||||
|
appLauncher.isEnabled().then(function(enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
return appLauncher.disable().then(function() {
|
||||||
|
return appLauncher.enable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
app.setAppUserModelId('com.squirrel.mattermost.Mattermost'); // Use explicit AppUserModelID
|
app.setAppUserModelId('com.squirrel.mattermost.Mattermost'); // Use explicit AppUserModelID
|
||||||
|
Reference in New Issue
Block a user