update-msi.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. diff --git a/src/vs/platform/update/common/update.ts b/src/vs/platform/update/common/update.ts
  2. index 7cd4a84..7cbdf21 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 caecd71..4c02afa 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. @@ -89,6 +93,13 @@ export class Win32UpdateService extends AbstractUpdateService {
  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. }
  45. @@ -243,6 +254,14 @@ export class Win32UpdateService extends AbstractUpdateService {
  46. } else {
  47. - spawn(this.availableUpdate.packagePath, ['/silent', '/mergetasks=runcode,!desktopicon,!quicklaunchicon'], {
  48. - detached: true,
  49. - stdio: ['ignore', 'ignore', 'ignore']
  50. - });
  51. + const type = getUpdateType();
  52. + if (type == UpdateType.WindowsInstaller) {
  53. + spawn('msiexec.exe', ['/i', this.availableUpdate.packagePath], {
  54. + detached: true,
  55. + stdio: ['ignore', 'ignore', 'ignore']
  56. + });
  57. + } else {
  58. + spawn(this.availableUpdate.packagePath, ['/silent', '/mergetasks=runcode,!desktopicon,!quicklaunchicon'], {
  59. + detached: true,
  60. + stdio: ['ignore', 'ignore', 'ignore']
  61. + });
  62. + }
  63. }