Skip to content

Commit f7091d2

Browse files
authored
Merge pull request element-hq#2556 from vector-im/dbkr/windows_fixes_missed_files
Missed files electron windows fixes
2 parents abc306b + ccea483 commit f7091d2

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

‎electron/build/install-spinner.gif‎

4.36 KB
Loading

‎electron/src/squirrelhooks.js‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const path = require('path');
2+
const spawn = require('child_process').spawn;
3+
const app = require('electron').app;
4+
5+
function run_update_exe(args, done) {
6+
const updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe');
7+
spawn(updateExe, args, {
8+
detached: true
9+
}).on('close', done);
10+
};
11+
12+
function check_squirrel_hooks() {
13+
if (process.platform != 'win32') return false;
14+
15+
const cmd = process.argv[1];
16+
const target = path.basename(process.execPath);
17+
if (cmd === '--squirrel-install' || cmd === '--squirrel-updated') {
18+
run_update_exe(['--createShortcut=' + target + ''], app.quit);
19+
return true;
20+
} else if (cmd === '--squirrel-uninstall') {
21+
run_update_exe(['--removeShortcut=' + target + ''], app.quit);
22+
return true;
23+
} else if (cmd === '--squirrel-obsolete') {
24+
app.quit();
25+
return true;
26+
}
27+
return false;
28+
}
29+
30+
module.exports = check_squirrel_hooks;

0 commit comments

Comments
 (0)