尝试修复.idea路径获取失败问题

This commit is contained in:
makejava 2020-09-23 10:59:39 +08:00
parent cadc87404b
commit 5401a8563f
1 changed files with 13 additions and 0 deletions

View File

@ -390,6 +390,19 @@ public class TableInfoServiceImpl implements TableInfoService {
}
// 获取.idea路径
VirtualFile ideaDir = baseDir.findChild(".idea");
// 当获取失败时尝试通过父级目录获取最多向上找3级目录
VirtualFile tmpDir = baseDir;
for (int i = 0; i < 3; i++) {
if (ideaDir != null) {
break;
}
tmpDir = tmpDir.getParent();
// 当没有父级目录时不再继续
if (tmpDir == null) {
break;
}
ideaDir = tmpDir.findChild(".idea");
}
if (ideaDir == null) {
Messages.showInfoMessage(".idea路径获取失败", MsgValue.TITLE_INFO);
String errorMsg = String.format("baseDir:%s, not found .idea child directory", baseDir.getPath());