fix #1661: using the new Windows installer

This commit is contained in:
antelle 2021-01-09 17:15:50 +01:00
parent 890f998fe0
commit 733833e8a4
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
1 changed files with 20 additions and 7 deletions

View File

@ -7,6 +7,10 @@ function installUpdate(updateFilePath) {
switch (process.platform) {
case 'darwin':
installDarwinUpdate(updateFilePath);
break;
case 'win32':
installWin32Update(updateFilePath);
break;
}
}
@ -28,13 +32,22 @@ function installDarwinUpdate(updateFilePath) {
}
const installerExecutable = path.join(tempInstallerPath, 'Contents', 'MacOS', 'applet');
spawn(
installerExecutable,
['--update', `--wait-pid=${process.pid}`, `--dmg=${updateFilePath}`, `--app=${appPath}`],
{
detached: true
}
).unref();
spawnDetached(installerExecutable, [
'--update',
`--wait-pid=${process.pid}`,
`--dmg=${updateFilePath}`,
`--app=${appPath}`
]);
}
function installWin32Update(updateFilePath) {
const appDir = path.dirname(electron.app.getPath('exe'));
spawnDetached(updateFilePath, [`/U1`, `/D=${appDir}`]);
}
function spawnDetached(command, args) {
const ps = spawn(command, args, { detached: true });
ps.unref();
}
module.exports.installUpdate = installUpdate;