cleanup update manager
This commit is contained in:
parent
82b2c44aaa
commit
9c4711cb60
|
@ -8,9 +8,8 @@
|
||||||
import * as fs from 'original-fs';
|
import * as fs from 'original-fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as electron from 'electron';
|
import * as electron from 'electron';
|
||||||
import * as platform from 'vs/base/common/platform';
|
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
import { IEnvService, getPlatformIdentifier } from 'vs/code/electron-main/env';
|
import { IEnvService } from 'vs/code/electron-main/env';
|
||||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||||
import { Win32AutoUpdaterImpl } from 'vs/code/electron-main/auto-updater.win32';
|
import { Win32AutoUpdaterImpl } from 'vs/code/electron-main/auto-updater.win32';
|
||||||
import { LinuxAutoUpdaterImpl } from 'vs/code/electron-main/auto-updater.linux';
|
import { LinuxAutoUpdaterImpl } from 'vs/code/electron-main/auto-updater.linux';
|
||||||
|
@ -85,11 +84,11 @@ export class UpdateManager extends EventEmitter implements IUpdateService {
|
||||||
this._feedUrl = null;
|
this._feedUrl = null;
|
||||||
this._channel = null;
|
this._channel = null;
|
||||||
|
|
||||||
if (platform.isWindows) {
|
if (process.platform === 'win32') {
|
||||||
this.raw = instantiationService.createInstance(Win32AutoUpdaterImpl);
|
this.raw = instantiationService.createInstance(Win32AutoUpdaterImpl);
|
||||||
} else if (platform.isLinux) {
|
} else if (process.platform === 'linux') {
|
||||||
this.raw = instantiationService.createInstance(LinuxAutoUpdaterImpl);
|
this.raw = instantiationService.createInstance(LinuxAutoUpdaterImpl);
|
||||||
} else if (platform.isMacintosh) {
|
} else if (process.platform === 'darwin') {
|
||||||
this.raw = electron.autoUpdater;
|
this.raw = electron.autoUpdater;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +152,7 @@ export class UpdateManager extends EventEmitter implements IUpdateService {
|
||||||
// for some reason updating on Mac causes the local storage not to be flushed.
|
// for some reason updating on Mac causes the local storage not to be flushed.
|
||||||
// we workaround this issue by forcing an explicit flush of the storage data.
|
// we workaround this issue by forcing an explicit flush of the storage data.
|
||||||
// see also https://github.com/Microsoft/vscode/issues/172
|
// see also https://github.com/Microsoft/vscode/issues/172
|
||||||
if (platform.isMacintosh) {
|
if (process.platform === 'darwin') {
|
||||||
electron.session.defaultSession.flushStorageData();
|
electron.session.defaultSession.flushStorageData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +240,7 @@ export class UpdateManager extends EventEmitter implements IUpdateService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platform.isWindows && !fs.existsSync(path.join(path.dirname(process.execPath), 'unins000.exe'))) {
|
if (process.platform === 'win32' && !fs.existsSync(path.join(path.dirname(process.execPath), 'unins000.exe'))) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,6 +248,8 @@ export class UpdateManager extends EventEmitter implements IUpdateService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${this.envService.updateUrl}/api/update/${getPlatformIdentifier()}/${channel}/${this.envService.product.commit}`;
|
const platform = process.platform === 'linux' ? `linux-${process.arch}` : process.platform;
|
||||||
|
|
||||||
|
return `${ this.envService.updateUrl }/api/update/${ platform }/${ channel }/${ this.envService.product.commit }`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue