mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ipr file should be the same project
This commit is contained in:
@@ -33,6 +33,7 @@ import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.ActionCallback;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.*;
|
||||
@@ -298,10 +299,11 @@ 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);
|
||||
return FileUtil.pathsEqual(parent.getPath(), existingBaseDirPath) &&
|
||||
ProjectFileType.DEFAULT_EXTENSION.equals(FileUtilRt.getExtension(projectFile.getName()));
|
||||
}
|
||||
|
||||
public static void focusProjectWindow(final Project p, boolean executeIfAppInactive) {
|
||||
|
||||
+3
-1
@@ -93,9 +93,11 @@ 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");
|
||||
assertFalse(ProjectUtil.isSameProject(iprFilePath.getAbsolutePath(), dirBasedProject));
|
||||
assertTrue(ProjectUtil.isSameProject(iprFilePath.getAbsolutePath(), dirBasedProject));
|
||||
File miscXmlFilePath = new File(projectDir, ".idea/misc.xml");
|
||||
assertTrue(ProjectUtil.isSameProject(miscXmlFilePath.getAbsolutePath(), dirBasedProject));
|
||||
File someOtherFilePath = new File(projectDir, "misc.xml");
|
||||
assertFalse(ProjectUtil.isSameProject(someOtherFilePath.getAbsolutePath(), dirBasedProject));
|
||||
}
|
||||
|
||||
public void testIsSameProjectForFileBasedProject() throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user