don't treat files in project folder as project files (IDEA-170271)

This commit is contained in:
Dennis Ushakov
2017-03-24 20:24:57 +03:00
parent 34eaae8d73
commit 9c35556803
2 changed files with 4 additions and 3 deletions
@@ -287,7 +287,7 @@ public class ProjectUtil {
return false;
}
final File projectFile = new File(projectFilePath);
File projectFile = new File(projectFilePath);
if (projectFile.isDirectory()) {
return FileUtil.pathsEqual(projectFilePath, existingBaseDirPath);
}
@@ -298,9 +298,10 @@ public class ProjectUtil {
File parent = projectFile.getParentFile();
if (parent.getName().equals(Project.DIRECTORY_STORE_FOLDER)) {
projectFile = parent;
parent = parent.getParentFile();
}
return parent != null && FileUtil.pathsEqual(parent.getPath(), existingBaseDirPath);
return parent != null && FileUtil.pathsEqual(parent.getPath(), existingBaseDirPath) && projectFile.getName().equals(Project.DIRECTORY_STORE_FOLDER);
}
public static void focusProjectWindow(final Project p, boolean executeIfAppInactive) {
@@ -93,7 +93,7 @@ public class ProjectOpeningTest extends PlatformTestCase {
assertTrue(ProjectUtil.isSameProject(projectDir.getAbsolutePath(), dirBasedProject));
assertFalse(ProjectUtil.isSameProject(createTempDir("project2").getAbsolutePath(), dirBasedProject));
File iprFilePath = new File(projectDir, "project.ipr");
assertTrue(ProjectUtil.isSameProject(iprFilePath.getAbsolutePath(), dirBasedProject));
assertFalse(ProjectUtil.isSameProject(iprFilePath.getAbsolutePath(), dirBasedProject));
File miscXmlFilePath = new File(projectDir, ".idea/misc.xml");
assertTrue(ProjectUtil.isSameProject(miscXmlFilePath.getAbsolutePath(), dirBasedProject));
}