提交 3a35853a 编写于 作者: J João Moreno

streamline update process

上级 70a1c2b6
......@@ -7,6 +7,7 @@
import { localize } from 'vs/nls';
import * as path from 'path';
import * as fs from 'fs';
import * as pfs from 'vs/base/node/pfs';
import { checksum } from 'vs/base/node/crypto';
import { EventEmitter } from 'events';
......@@ -21,7 +22,7 @@ import { IAutoUpdater } from 'vs/platform/update/common/update';
import product from 'vs/platform/node/product';
import { IStorageService } from 'vs/platform/storage/node/storage';
import { dialog } from 'electron';
import { getUpdateFeedUrl } from './updateFeedUrl';
import { getUpdateFeedUrl, Win32UninstallPath } from './updateFeedUrl';
interface IUpdate {
url: string;
......@@ -182,6 +183,19 @@ export class Win32AutoUpdaterImpl extends EventEmitter implements IAutoUpdater {
return;
}
if (process.arch === 'ia32' && this.arch === 'x64') {
const updatePackageContents = `@echo off\r\n"${Win32UninstallPath} /silent"\r\nstart /b "" "${this.updatePackagePath}" /silent /mergetasks=runcode,!desktopicon,!quicklaunchicon\r\n`;
const updatePackagePath = path.join(tmpdir(), 'vscode-update-32-to-64.bat');
fs.writeFileSync(updatePackagePath, updatePackageContents);
spawn('cmd.exe', [updatePackagePath], {
detached: true,
stdio: ['ignore', 'ignore', 'ignore']
});
return;
}
spawn(this.updatePackagePath, ['/silent', '/mergetasks=runcode,!desktopicon,!quicklaunchicon'], {
detached: true,
stdio: ['ignore', 'ignore', 'ignore']
......
......@@ -9,12 +9,14 @@ import * as fs from 'original-fs';
import * as path from 'path';
import product from 'vs/platform/node/product';
export const Win32UninstallPath = path.join(path.dirname(process.execPath), 'unins000.exe');
export function getUpdateFeedUrl(channel: string, arch: string = process.arch): string {
if (!channel) {
return null;
}
if (process.platform === 'win32' && !fs.existsSync(path.join(path.dirname(process.execPath), 'unins000.exe'))) {
if (process.platform === 'win32' && !fs.existsSync(Win32UninstallPath)) {
return null;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册