Skip to content

Commit

Permalink
Fixed showOpenDialog fallback (#10573)
Browse files Browse the repository at this point in the history
The showOpenDialog and other file dialog extension APIs now
correctly fall back to the workspace root when a defaultUri
is not provided.

Signed-off-by: Matthew Gordon <[email protected]>
  • Loading branch information
mcgordonite authored Dec 22, 2021
1 parent fad4231 commit 17b419f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/plugin-ext/src/main/browser/dialogs-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ export class DialogsMainImpl implements DialogsMain {
} catch {
rootStat = undefined;
}
}

// Try to use as root the parent folder of existing file URI/non existing URI
if (rootStat && !rootStat.isDirectory || !rootStat) {
try {
rootStat = await this.fileService.resolve(new URI(defaultUri).parent);
} catch {
rootStat = undefined;
// Try to use as root the parent folder of existing file URI/non existing URI
if (rootStat && !rootStat.isDirectory || !rootStat) {
try {
rootStat = await this.fileService.resolve(new URI(defaultUri).parent);
} catch {
rootStat = undefined;
}
}
}

Expand Down

0 comments on commit 17b419f

Please sign in to comment.