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

This commit is contained in:
makejava 2020-07-23 09:58:01 +08:00
parent 25b74213af
commit 6c1e82d6e0
1 changed files with 5 additions and 0 deletions

View File

@ -97,6 +97,11 @@ public class SaveFile {
// 路径对比判断项目路径是否为文件保存路径的子路径
String projectPath = handlerPath(baseDir.getPath());
String tmpFilePath = handlerPath(this.path);
if (tmpFilePath.length() > projectPath.length()) {
if (!"/".equals(tmpFilePath.substring(projectPath.length(), projectPath.length() + 1))) {
return false;
}
}
return tmpFilePath.indexOf(projectPath) == 0;
}