}
fireStepChange(10, "Scanning skeleton...");
PEFile pe = new PEFile(pattern);
pe.open();
PEResourceDirectory resdir = pe.getResourceDirectory();
boolean resb = false;
//
// Adds the jar only if the user selected one
//
if (data.getEmbeddedJar() == true) {
if (data.getJarLocation() == null) {
m_errors.add("Error: Jar is not specified!");
fireFailedChange();
return false;
}
fireStepChange(40, "Loading Jar...");
File jarloc = concFile(basedir, new File(data.getJarLocation()));
if (jarloc.exists() == false) {
m_errors.add("Error: Can't find jar at " + jarloc);
fireFailedChange();
return false;
}
ByteBuffer jardata = load(jarloc);
fireStepChange(60, "Adding Jar to Resources...");
resb = resdir.replaceResource(skel.getResourceCategory(), skel.getResourceJarId(), 1033, jardata);
if (resb == false) {
m_errors.add("Error: Can't replace jar resource! It is probably missing from the skeleton.");
fireFailedChange();
return false;
}
}
fireStepChange(70, "Adding Properties and Manifest to Resources...");
// Properties...
String props = PropertiesBuilder.makeProperties(basedir, data);
ByteBuffer propdata = convert(props);
resb = resdir.replaceResource(skel.getResourceCategory(), skel.getResourcePropsId(), 1033, propdata);
// Manifest...
String manifest = PropertiesBuilder.makeManifest(data, skel);
if (manifest == null || manifest.isEmpty()) {
manifest = "";
}
ByteBuffer manifestData = convert(manifest);
resb = resdir.replaceManifest(1, 1033, manifestData);
if (data.getIconLocation() != null) {
fireStepChange(80, "Loading icon...");
String iconpath;
if (new java.io.File(data.getIconLocation()).isAbsolute())