var app = require('./index'); var handleStartupEvent = function() { console.log(process.platform); switch (process.platform) { case 'win32': break; case 'linux': break; default: } 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; } })