Skip to content

Commit

Permalink
cleanup update manager
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Aug 18, 2016
1 parent 82b2c44 commit 9c4711c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/vs/code/electron-main/update-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
import * as fs from 'original-fs';
import * as path from 'path';
import * as electron from 'electron';
import * as platform from 'vs/base/common/platform';
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 { Win32AutoUpdaterImpl } from 'vs/code/electron-main/auto-updater.win32';
import { LinuxAutoUpdaterImpl } from 'vs/code/electron-main/auto-updater.linux';
Expand Down Expand Up @@ -85,11 +84,11 @@ export class UpdateManager extends EventEmitter implements IUpdateService {
this._feedUrl = null;
this._channel = null;

if (platform.isWindows) {
if (process.platform === 'win32') {
this.raw = instantiationService.createInstance(Win32AutoUpdaterImpl);
} else if (platform.isLinux) {
} else if (process.platform === 'linux') {
this.raw = instantiationService.createInstance(LinuxAutoUpdaterImpl);
} else if (platform.isMacintosh) {
} else if (process.platform === 'darwin') {
this.raw = electron.autoUpdater;
}

Expand Down Expand Up @@ -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.
// we workaround this issue by forcing an explicit flush of the storage data.
// see also https://github.com/Microsoft/vscode/issues/172
if (platform.isMacintosh) {
if (process.platform === 'darwin') {
electron.session.defaultSession.flushStorageData();
}

Expand Down Expand Up @@ -241,14 +240,16 @@ export class UpdateManager extends EventEmitter implements IUpdateService {
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;
}

if (!this.envService.updateUrl || !this.envService.product.commit) {
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 }`;
}
}

0 comments on commit 9c4711c

Please sign in to comment.