Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better UX when generating a Quarkus project #310

Merged
merged 1 commit into from
Oct 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/wizards/generateProject/generationWizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,13 @@ async function getTargetDirectory(projectName: string) {
const OPTION_OVERWRITE = 'Overwrite';
const OPTION_CHOOSE_NEW_DIR = 'Choose new directory';

let directory: Uri|undefined = await showOpenFolderDialog({ openLabel: LABEL_CHOOSE_FOLDER });
const defaultDirectoryUri = workspace.workspaceFolders ? workspace.workspaceFolders[0].uri : undefined;
rgrunber marked this conversation as resolved.
Show resolved Hide resolved
let directory: Uri|undefined = await showOpenFolderDialog({ openLabel: LABEL_CHOOSE_FOLDER, defaultUri: defaultDirectoryUri});

while (directory && fs.existsSync(path.join(directory.fsPath, projectName))) {
const overrideChoice: string = await window.showWarningMessage(MESSAGE_EXISTING_FOLDER, OPTION_OVERWRITE, OPTION_CHOOSE_NEW_DIR);
if (overrideChoice === OPTION_CHOOSE_NEW_DIR) {
directory = await showOpenFolderDialog({ openLabel: LABEL_CHOOSE_FOLDER });
directory = await showOpenFolderDialog({ openLabel: LABEL_CHOOSE_FOLDER, defaultUri: defaultDirectoryUri});
} else if (overrideChoice === OPTION_OVERWRITE) {
break;
} else { // User closed the warning window
Expand Down