Skip to content

Commit b8ecf87

Browse files
committed
Add appRoot to windows protocol handler
1 parent f820a9a commit b8ecf87

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/vs/code/electron-main/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ export class CodeApplication extends Disposable {
639639
// Watch Electron URLs and forward them to the UrlService
640640
const args = this.environmentService.args;
641641
const urls = args['open-url'] ? args._urls : [];
642-
const urlListener = new ElectronURLListener(urls || [], urlService, windowsMainService);
642+
const urlListener = new ElectronURLListener(urls || [], urlService, windowsMainService, this.environmentService);
643643
this._register(urlListener);
644644

645645
// Open our first window

src/vs/platform/url/electron-main/electronUrlListener.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { Event } from 'vs/base/common/event';
7+
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
78
import { IURLService } from 'vs/platform/url/common/url';
89
import product from 'vs/platform/product/common/product';
910
import { app, Event as ElectronEvent } from 'electron';
@@ -32,7 +33,8 @@ export class ElectronURLListener {
3233
constructor(
3334
initial: string | string[],
3435
@IURLService private readonly urlService: IURLService,
35-
@IWindowsMainService windowsMainService: IWindowsMainService
36+
@IWindowsMainService windowsMainService: IWindowsMainService,
37+
@IEnvironmentService environmentService: IEnvironmentService
3638
) {
3739
const globalBuffer = ((<any>global).getOpenUrls() || []) as string[];
3840
const rawBuffer = [
@@ -43,7 +45,9 @@ export class ElectronURLListener {
4345
this.uris = coalesce(rawBuffer.map(uriFromRawUrl));
4446

4547
if (isWindows) {
46-
app.setAsDefaultProtocolClient(product.urlProtocol, process.execPath, ['--open-url', '--']);
48+
const windowsParameters = environmentService.isBuilt ? [] : [`"${environmentService.appRoot}"`];
49+
windowsParameters.push('--open-url', '--');
50+
app.setAsDefaultProtocolClient(product.urlProtocol, process.execPath, windowsParameters);
4751
}
4852

4953
const onOpenElectronUrl = Event.map(

0 commit comments

Comments
 (0)