修复保存路径与项目路径存在相同前缀时,导致保存位置发生错误。

This commit is contained in:
makejava 2020-07-23 15:14:09 +08:00
parent 6c1e82d6e0
commit 2f845a5558
1 changed files with 7 additions and 1 deletions

View File

@ -210,7 +210,13 @@ public class SelectSavePath extends JDialog {
// 保存路径使用相对路径
String basePath = project.getBasePath();
if (!StringUtils.isEmpty(basePath) && savePath.startsWith(basePath)) {
savePath = savePath.replace(basePath, ".");
if (savePath.length() > basePath.length()) {
if ("/".equals(savePath.substring(basePath.length(), basePath.length() + 1))) {
savePath = savePath.replace(basePath, ".");
}
} else {
savePath = savePath.replace(basePath, ".");
}
}
// 保存配置
TableInfo tableInfo = tableInfoService.getTableInfoAndConfig(cacheDataUtils.getSelectDbTable());