提交 84ad7119 编写于 作者: S Sandeep Somavarapu

Use URI transformer for download service channel

上级 8eb36b9c
...@@ -45,6 +45,7 @@ import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; ...@@ -45,6 +45,7 @@ import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IDownloadService } from 'vs/platform/download/common/download'; import { IDownloadService } from 'vs/platform/download/common/download';
import { DownloadServiceChannelClient } from 'vs/platform/download/node/downloadIpc'; import { DownloadServiceChannelClient } from 'vs/platform/download/node/downloadIpc';
import { DefaultURITransformer } from 'vs/base/common/uriIpc';
export interface ISharedProcessConfiguration { export interface ISharedProcessConfiguration {
readonly machineId: string; readonly machineId: string;
...@@ -91,7 +92,7 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I ...@@ -91,7 +92,7 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
services.set(IDialogService, new DialogChannelClient(dialogChannel)); services.set(IDialogService, new DialogChannelClient(dialogChannel));
const downloadChannel = server.getChannel('download', { routeCall: route, routeEvent: route }); const downloadChannel = server.getChannel('download', { routeCall: route, routeEvent: route });
services.set(IDownloadService, new DownloadServiceChannelClient(downloadChannel)); services.set(IDownloadService, new DownloadServiceChannelClient(downloadChannel, DefaultURITransformer));
const instantiationService = new InstantiationService(services); const instantiationService = new InstantiationService(services);
......
...@@ -14,6 +14,7 @@ import { Event, Emitter, buffer } from 'vs/base/common/event'; ...@@ -14,6 +14,7 @@ import { Event, Emitter, buffer } from 'vs/base/common/event';
import { IDownloadService } from 'vs/platform/download/common/download'; import { IDownloadService } from 'vs/platform/download/common/download';
import { mkdirp } from 'vs/base/node/pfs'; import { mkdirp } from 'vs/base/node/pfs';
import { onUnexpectedError } from 'vs/base/common/errors'; import { onUnexpectedError } from 'vs/base/common/errors';
import { IURITransformer } from 'vs/base/common/uriIpc';
export type UploadResponse = Buffer | Error | undefined; export type UploadResponse = Buffer | Error | undefined;
...@@ -75,7 +76,7 @@ export class DownloadServiceChannel implements IDownloadServiceChannel { ...@@ -75,7 +76,7 @@ export class DownloadServiceChannel implements IDownloadServiceChannel {
listen(event: string, arg?: any): Event<any> { listen(event: string, arg?: any): Event<any> {
switch (event) { switch (event) {
case 'upload': return buffer(upload(arg)); case 'upload': return buffer(upload(URI.revive(arg)));
} }
return undefined; return undefined;
} }
...@@ -89,9 +90,10 @@ export class DownloadServiceChannelClient implements IDownloadService { ...@@ -89,9 +90,10 @@ export class DownloadServiceChannelClient implements IDownloadService {
_serviceBrand: any; _serviceBrand: any;
constructor(private channel: IDownloadServiceChannel) { } constructor(private channel: IDownloadServiceChannel, private uriTransformer: IURITransformer) { }
download(from: URI, to: string): TPromise<void> { download(from: URI, to: string): TPromise<void> {
from = this.uriTransformer.transformOutgoing(from);
const dirName = path.dirname(to); const dirName = path.dirname(to);
let out: fs.WriteStream; let out: fs.WriteStream;
return new TPromise((c, e) => { return new TPromise((c, e) => {
......
...@@ -87,15 +87,15 @@ export class ExtensionManagementChannelClient implements IExtensionManagementSer ...@@ -87,15 +87,15 @@ export class ExtensionManagementChannelClient implements IExtensionManagementSer
get onDidUninstallExtension(): Event<DidUninstallExtensionEvent> { return this.channel.listen('onDidUninstallExtension'); } get onDidUninstallExtension(): Event<DidUninstallExtensionEvent> { return this.channel.listen('onDidUninstallExtension'); }
zip(extension: ILocalExtension): TPromise<URI> { zip(extension: ILocalExtension): TPromise<URI> {
return this.channel.call('zip', [extension]).then(result => URI.revive(this.uriTransformer.transformIncoming(result))); return this.channel.call('zip', [this._transformOutgoing(extension)]).then(result => URI.revive(this.uriTransformer.transformIncoming(result)));
} }
unzip(zipLocation: URI): TPromise<void> { unzip(zipLocation: URI): TPromise<void> {
return this.channel.call('unzip', [zipLocation]); return this.channel.call('unzip', [this.uriTransformer.transformOutgoing(zipLocation)]);
} }
install(vsix: URI): TPromise<void> { install(vsix: URI): TPromise<void> {
return this.channel.call('install', [vsix]); return this.channel.call('install', [this.uriTransformer.transformOutgoing(vsix)]);
} }
installFromGallery(extension: IGalleryExtension): TPromise<void> { installFromGallery(extension: IGalleryExtension): TPromise<void> {
......
...@@ -339,7 +339,7 @@ export class WorkbenchShell extends Disposable { ...@@ -339,7 +339,7 @@ export class WorkbenchShell extends Disposable {
sharedProcess sharedProcess
.done(client => { .done(client => {
client.registerChannel('download', instantiationService.createInstance(DownloadServiceChannel)); client.registerChannel('download', new DownloadServiceChannel());
client.registerChannel('dialog', instantiationService.createInstance(DialogChannel)); client.registerChannel('dialog', instantiationService.createInstance(DialogChannel));
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册