fix: update msi (#1270)

This commit is contained in:
Baptiste Augrain 2022-09-27 20:14:27 +02:00 committed by GitHub
parent ecd187faa2
commit b5b3376645
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 1 deletions

View file

@ -7,7 +7,9 @@ cd vscode || { echo "'vscode' dir not found"; exit 1; }
git add . git add .
git reset -q --hard HEAD git reset -q --hard HEAD
git apply --reject "${FILE}" if [[ -f "${file}" ]]; then
git apply --reject "${FILE}"
fi
read -p "Press any key when the conflict have been resolved..." -n1 -s read -p "Press any key when the conflict have been resolved..." -n1 -s

45
patches/update-msi.patch Normal file
View file

@ -0,0 +1,45 @@
diff --git a/src/vs/platform/update/common/update.ts b/src/vs/platform/update/common/update.ts
index 7cd4a84..7cbdf21 100644
--- 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 caecd71..eb85ed0 100644
--- 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;
+ } else if (path.basename(path.normalize(path.join(process.execPath, '..', ''))) === 'Program Files') {
+ _updateType = UpdateType.WindowsInstaller;
+ } else {
+ _updateType = UpdateType.Archive;
+ }
}
@@ -89,6 +93,13 @@ export class Win32UpdateService extends AbstractUpdateService {
- 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';
+ }
}