Skip to content
Snippets Groups Projects
Commit bbbf7412 authored by david_williams's avatar david_williams
Browse files

improve signing

parent 9e1c90f8
No related branches found
No related tags found
No related merge requests found
......@@ -160,7 +160,7 @@ public class UpdatePackPropertiesFile extends Task {
if (!success) {
throw new BuildException("Could not rename original zip file to backup name.");
}
File newarchive = new File(tempzipFileName);
success = newarchive.renameTo(originalarchive);
if (!success) {
......@@ -233,52 +233,33 @@ public class UpdatePackPropertiesFile extends Task {
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
String entryName = files[i].getCanonicalPath().substring(rootDirectory.length());
entryName = translate(entryName, '\\', "/");
if (!entryName.endsWith("/")) {
entryName = entryName + "/";
}
log(" Adding Directory Entry: " + entryName, Project.MSG_DEBUG);
out.putNextEntry(new ZipEntry(entryName));
// now recurse through the directory
addDir(files[i], out, rootDirectory);
}
else {
FileInputStream in = new FileInputStream(files[i].getAbsolutePath());
String entryName = files[i].getAbsolutePath().substring(rootDirectory.length());
log(" Adding: " + entryName, Project.MSG_DEBUG);
out.putNextEntry(new ZipEntry(entryName));
// Transfer from the file to the ZIP file
int len;
while ((len = in.read(tmpBuf)) > 0) {
out.write(tmpBuf, 0, len);
String entryName = files[i].getAbsolutePath().substring(rootDirectory.length());
if (!entryName.equals(".") && !entryName.equals("..")) {
entryName = slashify(entryName, files[i].isDirectory());
if (files[i].isDirectory()) {
log(" Adding Directory Entry: " + entryName); //, Project.MSG_DEBUG);
out.putNextEntry(new ZipEntry(entryName));
// now recurse through the directory
addDir(files[i], out, rootDirectory);
}
else {
FileInputStream in = new FileInputStream(files[i].getAbsolutePath());
log(" Adding: " + entryName); //, Project.MSG_DEBUG);
// Complete the entry
out.closeEntry();
in.close();
}
}
}
out.putNextEntry(new ZipEntry(entryName));
// Transfer from the file to the ZIP file
int len;
while ((len = in.read(tmpBuf)) > 0) {
out.write(tmpBuf, 0, len);
}
private String translate(String entryName, char c, String d) {
String result = entryName;
if (entryName.indexOf(c) > -1) {
StringBuffer tempHold = new StringBuffer(entryName);
for (int i = 0; i < tempHold.length(); i++) {
if (tempHold.charAt(i) == c) {
tempHold.replace(i, i+1, d);
// Complete the entry
out.closeEntry();
in.close();
}
}
result = tempHold.toString();
}
return result;
}
private String checkIfJarsSigned(String currentresults, String destinationDir, String parentDir, String[] jars) throws IOException {
......@@ -361,4 +342,13 @@ public class UpdatePackPropertiesFile extends Task {
this.archiveFilename = archiveFilename;
}
private String slashify(String path, boolean isDirectory) {
String p = path;
if (File.separatorChar != '/')
p = p.replace(File.separatorChar, '/');
if (!p.endsWith("/") && isDirectory)
p = p + "/";
return p;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment