|
5 | 5 |
|
6 | 6 | import { app, BrowserWindow, dialog, protocol, session, Session, systemPreferences, WebFrameMain } from 'electron';
|
7 | 7 | import { validatedIpcMain } from 'vs/base/parts/ipc/electron-main/ipcMain';
|
8 |
| -import { statSync } from 'fs'; |
9 | 8 | import { hostname, release } from 'os';
|
10 | 9 | import { VSBuffer } from 'vs/base/common/buffer';
|
11 | 10 | import { toErrorMessage } from 'vs/base/common/errorMessage';
|
@@ -364,7 +363,7 @@ export class CodeApplication extends Disposable {
|
364 | 363 | event.preventDefault();
|
365 | 364 |
|
366 | 365 | // Keep in array because more might come!
|
367 |
| - macOpenFileURIs.push(this.getWindowOpenableFromPathSync(path)); |
| 366 | + macOpenFileURIs.push(hasWorkspaceFileExtension(path) ? { workspaceUri: URI.file(path) } : { fileUri: URI.file(path) }); |
368 | 367 |
|
369 | 368 | // Clear previous handler if any
|
370 | 369 | if (runningTimeout !== undefined) {
|
@@ -1018,7 +1017,7 @@ export class CodeApplication extends Disposable {
|
1018 | 1017 | return windowsMainService.open({
|
1019 | 1018 | context: OpenContext.DOCK,
|
1020 | 1019 | cli: args,
|
1021 |
| - urisToOpen: macOpenFiles.map(file => this.getWindowOpenableFromPathSync(file)), |
| 1020 | + urisToOpen: macOpenFiles.map(path => (hasWorkspaceFileExtension(path) ? { workspaceUri: URI.file(path) } : { fileUri: URI.file(path) })), |
1022 | 1021 | noRecentEntry,
|
1023 | 1022 | waitMarkerFileURI,
|
1024 | 1023 | initialStartup: true,
|
@@ -1110,23 +1109,6 @@ export class CodeApplication extends Disposable {
|
1110 | 1109 | return undefined;
|
1111 | 1110 | }
|
1112 | 1111 |
|
1113 |
| - private getWindowOpenableFromPathSync(path: string): IWindowOpenable { |
1114 |
| - try { |
1115 |
| - const fileStat = statSync(path); |
1116 |
| - if (fileStat.isDirectory()) { |
1117 |
| - return { folderUri: URI.file(path) }; |
1118 |
| - } |
1119 |
| - |
1120 |
| - if (hasWorkspaceFileExtension(path)) { |
1121 |
| - return { workspaceUri: URI.file(path) }; |
1122 |
| - } |
1123 |
| - } catch (error) { |
1124 |
| - // ignore errors |
1125 |
| - } |
1126 |
| - |
1127 |
| - return { fileUri: URI.file(path) }; |
1128 |
| - } |
1129 |
| - |
1130 | 1112 | private afterWindowOpen(accessor: ServicesAccessor, sharedProcess: SharedProcess): void {
|
1131 | 1113 | const telemetryService = accessor.get(ITelemetryService);
|
1132 | 1114 | const updateService = accessor.get(IUpdateService);
|
|
0 commit comments