Inline electron-squirrel-startup (Fixes #44)

Now the desktop icon will only be created on installation, not on
update.
This commit is contained in:
Gregory Schier committed 2019-05-10 12:25:50 -04:00
1 parent ca38f215bf
commit 7c77d9d2e6
4 files changed
+855 -113

No files matched your search

@@ -1,5 +1,5 @@
// @flow
import needsRestart from 'electron-squirrel-startup';
import needsRestart from './main/squirrel-startup';
import * as electron from 'electron';
import * as errorHandling from './main/error-handling';
import * as updates from './main/updates';
@@ -0,0 +1,41 @@
import path from 'path';
import { spawn } from 'child_process';
import { app } from 'electron';
function run(args, done) {
const updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe');
spawn(updateExe, args, {
detached: true,
}).on('close', done);
}
function check() {
if (process.platform === 'win32') {
const cmd = process.argv[1];
console.log('processing squirrel command `%s`', cmd);
const target = path.basename(process.execPath);
if (cmd === '--squirrel-install') {
run(['--createShortcut=' + target + ''], app.quit);
return true;
}
if (cmd === '--squirrel-updated') {
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();
+813 -111
View File
File diff suppressed because it is too large. Load diff
-1
View File
@@ -106,7 +106,6 @@
"codemirror-graphql": "^0.8.3",
"deep-equal": "^1.0.1",
"electron-context-menu": "^0.10.0",
"electron-squirrel-startup": "^1.0.0",
"font-scanner": "^0.1.1",
"fs-extra": "^5.0.0",
"fuzzysort": "^1.1.1",