- Make ProjectExtensionManager delete resource zip folders when nothing was kept

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9921 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent 2f73363107
commit 7a0b6b15fc
  1. 9
      sdk/jme3-core/src/com/jme3/gde/core/j2seproject/ProjectExtensionManager.java

@ -46,7 +46,6 @@ import java.util.logging.Logger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.netbeans.api.project.Project;
import org.netbeans.api.project.ProjectManager;
import org.netbeans.api.project.ant.AntBuildExtender;
import org.netbeans.api.project.libraries.LibraryManager;
import org.netbeans.modules.java.j2seproject.J2SEProject;
@ -478,6 +477,7 @@ public class ProjectExtensionManager {
return;
}
InputStream in = zipFile.openStream();
boolean kept = false;
try {
ZipInputStream str = new ZipInputStream(in);
ZipEntry entry;
@ -492,11 +492,12 @@ public class ProjectExtensionManager {
}
String fileName = resourcesFolder + "/" + extensionName + "/" + entry.getName();
FileObject obj = projectRoot.getFileObject(fileName);
if (obj != null && !obj.equals(projectRoot)) {
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Deleting file " + obj.getNameExt());
if (obj != null && !obj.equals(projectRoot) && !obj.isFolder()) {
if (entry.getSize() != -1 && entry.getSize() == obj.getSize()) {
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Deleting file " + obj.getNameExt());
obj.delete();
} else {
kept = true;
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Keeping file " + obj.getNameExt());
}
}
@ -505,7 +506,7 @@ public class ProjectExtensionManager {
in.close();
}
FileObject folder = projectRoot.getFileObject(resourcesFolder + "/" + extensionName);
if (folder != null && folder.getChildren().length == 0) {
if (folder != null && !kept) {
folder.delete();
}
FileObject resourceFolder = projectRoot.getFileObject(resourcesFolder);

Loading…
Cancel
Save