update.patch 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. diff --git a/src/vs/platform/update/common/update.ts b/src/vs/platform/update/common/update.ts
  2. index 0f79e17..97ea778 100644
  3. --- a/src/vs/platform/update/common/update.ts
  4. +++ b/src/vs/platform/update/common/update.ts
  5. @@ -48,3 +48,4 @@ export const enum UpdateType {
  6. Archive,
  7. - Snap
  8. + Snap,
  9. + WindowsInstaller,
  10. }
  11. diff --git a/src/vs/platform/update/electron-main/updateService.win32.ts b/src/vs/platform/update/electron-main/updateService.win32.ts
  12. index 99bf807..27e77f0 100644
  13. --- a/src/vs/platform/update/electron-main/updateService.win32.ts
  14. +++ b/src/vs/platform/update/electron-main/updateService.win32.ts
  15. @@ -41,5 +41,9 @@ function getUpdateType(): UpdateType {
  16. if (typeof _updateType === 'undefined') {
  17. - _updateType = fs.existsSync(path.join(path.dirname(process.execPath), 'unins000.exe'))
  18. - ? UpdateType.Setup
  19. - : UpdateType.Archive;
  20. + if (fs.existsSync(path.join(path.dirname(process.execPath), 'unins000.exe'))) {
  21. + _updateType = UpdateType.Setup;
  22. + } else if (path.basename(path.normalize(path.join(process.execPath, '..', '..'))) === 'Program Files') {
  23. + _updateType = UpdateType.WindowsInstaller;
  24. + } else {
  25. + _updateType = UpdateType.Archive;
  26. + }
  27. }
  28. @@ -103,6 +107,16 @@ export class Win32UpdateService extends AbstractUpdateService implements IRelaun
  29. - if (getUpdateType() === UpdateType.Archive) {
  30. - platform += '-archive';
  31. - } else if (this.productService.target === 'user') {
  32. - platform += '-user';
  33. + switch (getUpdateType()) {
  34. + case UpdateType.Archive:
  35. + platform += '-archive';
  36. + break;
  37. + case UpdateType.WindowsInstaller:
  38. + platform += '-msi';
  39. + break;
  40. + default:
  41. + if (this.productService.target === 'user') {
  42. + platform += '-user';
  43. + }
  44. + else {
  45. + platform += '-system';
  46. + }
  47. }
  48. @@ -257,6 +271,14 @@ export class Win32UpdateService extends AbstractUpdateService implements IRelaun
  49. } else {
  50. - spawn(this.availableUpdate.packagePath, ['/silent', '/log', '/mergetasks=runcode,!desktopicon,!quicklaunchicon'], {
  51. - detached: true,
  52. - stdio: ['ignore', 'ignore', 'ignore']
  53. - });
  54. + const type = getUpdateType();
  55. + if (type == UpdateType.WindowsInstaller) {
  56. + spawn('msiexec.exe', ['/i', this.availableUpdate.packagePath], {
  57. + detached: true,
  58. + stdio: ['ignore', 'ignore', 'ignore']
  59. + });
  60. + } else {
  61. + spawn(this.availableUpdate.packagePath, ['/silent', '/log', '/mergetasks=runcode,!desktopicon,!quicklaunchicon'], {
  62. + detached: true,
  63. + stdio: ['ignore', 'ignore', 'ignore']
  64. + });
  65. + }
  66. }