Skip to content

Commit

Permalink
Fixed showOpenDialog fallback (eclipse-theia#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 committed Dec 23, 2021
1 parent 1bd30df commit 9c99ede
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 9c99ede

Please sign in to comment.