From 2a05f9d0729c0e95bbd5ff5046d17f4e2590d0c6 Mon Sep 17 00:00:00 2001 From: nik Date: Fri, 26 Dec 2014 12:35:50 +0300 Subject: [PATCH] IDEA-133903: Overriding existing project files in the new project wizard has no effect --- .../openapi/project/impl/ProjectManagerImpl.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java index 4988155eea4b..38cd2345032f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java @@ -257,6 +257,18 @@ public class ProjectManagerImpl extends ProjectManagerEx implements PersistentSt } } + File projectFile = new File(filePath); + if (projectFile.isFile()) { + FileUtil.delete(projectFile); + } + else { + File[] files = new File(projectFile, Project.DIRECTORY_STORE_FOLDER).listFiles(); + if (files != null) { + for (File file : files) { + FileUtil.delete(file); + } + } + } ProjectImpl project = createProject(projectName, filePath, false, optimiseTestLoadSpeed); try { initProject(project, useDefaultProjectSettings ? (ProjectImpl)getDefaultProject() : null);