vscodium/patches/update-windows.patch

68 lines
2.5 KiB
Diff
Raw Normal View History

2022-09-27 14:14:27 -04:00
diff --git a/src/vs/platform/update/common/update.ts b/src/vs/platform/update/common/update.ts
index 0f79e17..97ea778 100644
2022-09-27 14:14:27 -04:00
--- a/src/vs/platform/update/common/update.ts
+++ b/src/vs/platform/update/common/update.ts
@@ -48,3 +48,4 @@ export const enum UpdateType {
Archive,
- Snap
+ Snap,
+ WindowsInstaller,
}
diff --git a/src/vs/platform/update/electron-main/updateService.win32.ts b/src/vs/platform/update/electron-main/updateService.win32.ts
index 99bf807..27e77f0 100644
2022-09-27 14:14:27 -04:00
--- a/src/vs/platform/update/electron-main/updateService.win32.ts
+++ b/src/vs/platform/update/electron-main/updateService.win32.ts
@@ -41,5 +41,9 @@ function getUpdateType(): UpdateType {
if (typeof _updateType === 'undefined') {
- _updateType = fs.existsSync(path.join(path.dirname(process.execPath), 'unins000.exe'))
- ? UpdateType.Setup
- : UpdateType.Archive;
+ if (fs.existsSync(path.join(path.dirname(process.execPath), 'unins000.exe'))) {
+ _updateType = UpdateType.Setup;
2022-09-30 02:44:14 -04:00
+ } else if (path.basename(path.normalize(path.join(process.execPath, '..', '..'))) === 'Program Files') {
2022-09-27 14:14:27 -04:00
+ _updateType = UpdateType.WindowsInstaller;
+ } else {
+ _updateType = UpdateType.Archive;
+ }
}
@@ -103,6 +107,16 @@ export class Win32UpdateService extends AbstractUpdateService implements IRelaun
2022-09-27 14:14:27 -04:00
- if (getUpdateType() === UpdateType.Archive) {
- platform += '-archive';
- } else if (this.productService.target === 'user') {
- platform += '-user';
+ switch (getUpdateType()) {
+ case UpdateType.Archive:
+ platform += '-archive';
+ break;
+ case UpdateType.WindowsInstaller:
+ platform += '-msi';
+ break;
+ default:
+ if (this.productService.target === 'user') {
+ platform += '-user';
+ }
+ else {
+ platform += '-system';
2022-09-27 14:14:27 -04:00
+ }
}
@@ -257,6 +271,14 @@ export class Win32UpdateService extends AbstractUpdateService implements IRelaun
2022-09-30 02:44:14 -04:00
} else {
2023-05-28 17:07:30 -04:00
- spawn(this.availableUpdate.packagePath, ['/silent', '/log', '/mergetasks=runcode,!desktopicon,!quicklaunchicon'], {
2022-09-30 02:44:14 -04:00
- detached: true,
- stdio: ['ignore', 'ignore', 'ignore']
- });
+ const type = getUpdateType();
+ if (type == UpdateType.WindowsInstaller) {
+ spawn('msiexec.exe', ['/i', this.availableUpdate.packagePath], {
+ detached: true,
+ stdio: ['ignore', 'ignore', 'ignore']
+ });
+ } else {
2023-05-28 17:07:30 -04:00
+ spawn(this.availableUpdate.packagePath, ['/silent', '/log', '/mergetasks=runcode,!desktopicon,!quicklaunchicon'], {
2022-09-30 02:44:14 -04:00
+ detached: true,
+ stdio: ['ignore', 'ignore', 'ignore']
+ });
+ }
}