cyb3r-downloader/src/main.js

47 lines
1.6 KiB
JavaScript
Raw Normal View History

2017-08-13 23:47:09 +02:00
var app = require('./index');
var handleStartupEvent = function() {
if (process.platform !== 'win32') {
return false;
}
var squirrelCommand = process.argv[1];
console.log(squirrelCommand);
switch (squirrelCommand) {
case '--squirrel-install':
target = path.basename(process.execPath);
updateDotExe = path.resolve(path.dirname(process.execPath), '..', 'update.exe');
var createShortcut = updateDotExe + ' --createShortcut=' + target + ' --shortcut-locations=Desktop,StartMenu' ;
console.log (createShortcut);
exec(createShortcut);
// Always quit when done
app.quit();
return true;
case '--squirrel-uninstall':
// Undo anything you did in the --squirrel-install and
// --squirrel-updated handlers
target = path.basename(process.execPath);
updateDotExe = path.resolve(path.dirname(process.execPath), '..', 'update.exe');
var createShortcut = updateDotExe + ' --removeShortcut=' + target ;
console.log (createShortcut);
exec(createShortcut);
// Always quit when done
app.quit();
return true;
case '--squirrel-obsolete':
// This is called on the outgoing version of your app before
// we update to the new version - it's the opposite of
// --squirrel-updated
app.quit();
return true;
}
};
(function(){
if (handleStartupEvent()) {
return;
}
})