Now we can delete a project even if it hasn't been saved to file yet.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@214 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-03-05 19:43:08 +00:00
parent 676a189968
commit 5c845f06bf

View File

@ -309,14 +309,20 @@ public class ProjectManager implements Serializable {
} }
public boolean deleteProject(Project project) { public boolean deleteProject(Project project) {
File file = new File(_dir, project.id + ".project"); if (_projectsMetadata.containsKey(project.id)) {
if (file.exists()) { _projects.remove(project.id);
_projects.remove(project.id); _projectsMetadata.remove(project.id);
_projectsMetadata.remove(project.id);
boolean result = file.delete(); File file = new File(_dir, project.id + ".project");
save(); if (file.exists()) {
return result; file.delete();
} }
return false;
save();
return true;
} else {
return false;
}
} }
} }