Open tymmesyde opened 5 years ago
Same here. Pretty wired.
I just resolve this problem by handling squirrel event: --squirrel-firstrun, based on project electron-squirrel-startup
You can check my code below. In my case I just quit immediately after create shortcut on firstrun.
var path = require('path');
var spawn = require('child_process').spawn;
var app = require('electron').app;
var run = function(args, done) {
var updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe');
// debug('Spawning `%s` with args `%s`', updateExe, args);
spawn(updateExe, args, {
detached: true
}).on('close', done);
};
var check = function() {
if (process.platform === 'win32') {
var cmd = process.argv[1];
// debug('processing squirrel command `%s`', cmd);
var target = path.basename(process.execPath);
if (cmd === '--squirrel-firstrun') {
run(['--createShortcut=' + target + ''], app.quit);
return true;
}
if (cmd === '--squirrel-install' || cmd === '--squirrel-updated') {
run(['--createShortcut=' + target + ''], app.quit);
return true;
}
if (cmd === '--squirrel-uninstall') {
run(['--removeShortcut=' + target + ''], app.quit);
return true;
}
if (cmd === '--squirrel-obsolete') {
app.quit();
return true;
}
}
return false;
};
module.exports = check();
Hey thanks for the hint I'd like to do the same, but if my app declares "requested-execution-level": "requireAdministrator" No Squirel hook is being called (so I don't get a --squirrel-uninstall for ex) Did you found a solution for this ?
Same here, any update?
I'm using forge and I need to request admin rights for my app but when i do that, there no shortcut created on the Desktop. When i remove
requested-execution-level
from mypackage.json
, it works. What should I do ?