From f011722bf098c52ddf5730fd3973e785532325b6 Mon Sep 17 00:00:00 2001 From: Olesya Smirnova Date: Mon, 2 Feb 2009 18:02:37 +0300 Subject: [PATCH] IDEADEV-34435 --- platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java | 7 +++++++ platform-impl/src/com/intellij/ide/impl/ProjectUtil.java | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java b/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java index 22745c9797..9ae91d89e4 100644 --- a/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java +++ b/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java @@ -1,5 +1,6 @@ package com.intellij.ide; +import com.intellij.ide.impl.ProjectUtil; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.PlatformDataKeys; @@ -53,6 +54,12 @@ public abstract class RecentProjectsManagerBase implements PersistentStateCompon if (myState.lastPath != null && !new File(myState.lastPath).exists()) { myState.lastPath = null; } + if (myState.lastPath != null) { + File lastFile = new File(myState.lastPath); + if (lastFile.isDirectory() && !new File(lastFile, ProjectUtil.DIRECTORY_BASED_PROJECT_DIR).exists()) { + myState.lastPath = null; + } + } } private void validateRecentProjects() { diff --git a/platform-impl/src/com/intellij/ide/impl/ProjectUtil.java b/platform-impl/src/com/intellij/ide/impl/ProjectUtil.java index f6d05594bd..cbd53dc3be 100644 --- a/platform-impl/src/com/intellij/ide/impl/ProjectUtil.java +++ b/platform-impl/src/com/intellij/ide/impl/ProjectUtil.java @@ -191,6 +191,12 @@ public class ProjectUtil { return null; } + if (file.isDirectory() && !new File(file, DIRECTORY_BASED_PROJECT_DIR).exists()) { + Messages.showMessageDialog(IdeBundle.message("error.project.file.does.not.exist", new File(file, DIRECTORY_BASED_PROJECT_DIR).getPath()), CommonBundle.getErrorTitle(), + Messages.getErrorIcon()); + return null; + } + Project[] openProjects = ProjectManager.getInstance().getOpenProjects(); for (Project project : openProjects) { if (isSameProject(path, project)) { -- 2.11.4.GIT