PY-9231 Allow to create virtual env inside an empty directory

This commit is contained in:
Mikhail Golubev
2015-10-25 15:49:43 +03:00
parent 40733b0fd4
commit 25ace0da2b
@@ -182,10 +182,14 @@ public abstract class AbstractCreateVirtualEnvDialog extends IdeaDialog {
protected void checkValid() {
final String projectName = myName.getText();
if (new File(getDestination()).exists()) {
setOKActionEnabled(false);
setErrorText("Directory already exists");
return;
final File destFile = new File(getDestination());
if (destFile.exists()) {
final String[] content = destFile.list();
if (content != null && content.length != 0) {
setOKActionEnabled(false);
setErrorText("Directory is not empty");
return;
}
}
if (StringUtil.isEmptyOrSpaces(projectName)) {
setOKActionEnabled(false);
@@ -254,6 +258,7 @@ public abstract class AbstractCreateVirtualEnvDialog extends IdeaDialog {
}
}
}, ModalityState.any());
throw new RuntimeException(e);
}
}