update new workspace validation to throw errors to make code more reusable (#13856)

This commit is contained in:
Kim Santiago
2020-12-18 13:32:42 -08:00
committed by GitHub
parent 0b8b6064ed
commit c7303803ba
4 changed files with 18 additions and 33 deletions

View File

@@ -43,9 +43,9 @@ export class NewProjectDialog extends DialogBase {
return false;
}
const sameFolderAsNewProject = path.join(this.model.location, this.model.name) === path.dirname(this.workspaceInputBox!.value!);
if (this.workspaceInputBox!.enabled && !await this.validateNewWorkspace(sameFolderAsNewProject)) {
return false;
if (this.workspaceInputBox!.enabled) {
const sameFolderAsNewProject = path.join(this.model.location, this.model.name) === path.dirname(this.workspaceInputBox!.value!);
await this.validateNewWorkspace(sameFolderAsNewProject);
}
return true;