> On Thu, 27 Sep 2001, Stefano Mancarella
> <[EMAIL PROTECTED]> wrote:
> > Is it good to allow the use of "update=true" when the archive does
> > not exist?
> No 8-)
So here's a patch which prevents it. ;)
(Against Zip.java rev. 1.52)
--- Zip.java.orig Thu Sep 27 18:13:31 2001
+++ Zip.java Thu Sep 27 18:14:41 2001
@@ -212,10 +212,10 @@
// we don't need to update if the original file doesn't exist
addingNewFiles = true;
- boolean reallyDoUpdate = false;
- if (doUpdate && zipFile.exists())
- {
- reallyDoUpdate = true;
+ if (doUpdate) {
+ if (!zipFile.exists()) {
+ throw new BuildException("Can't update because file doesn't
exist");
+ }
int i;
for (i=0; i < 1000; i++)
@@ -261,7 +261,7 @@
return;
}
- String action = reallyDoUpdate ? "Updating " : "Building ";
+ String action = doUpdate ? "Updating " : "Building ";
log(action + archiveType +": "+ zipFile.getAbsolutePath());
@@ -284,7 +284,7 @@
}
// Add the explicit filesets to the archive.
addFiles(filesets, zOut);
- if (reallyDoUpdate) {
+ if (doUpdate) {
addingNewFiles = false;
ZipFileSet oldFiles = new ZipFileSet();
oldFiles.setSrc(renamedFile);
@@ -329,7 +329,7 @@
msg += " (and the archive is probably corrupt but I could not
delete it)";
}
- if (reallyDoUpdate) {
+ if (doUpdate) {
if (!renamedFile.renameTo(zipFile)) {
msg+=" (and I couldn't rename the temporary file "+
renamedFile.getName()+" back)";
@@ -342,7 +342,7 @@
}
// If we've been successful on an update, delete the temporary file
- if (success && reallyDoUpdate) {
+ if (success && doUpdate) {
if (!renamedFile.delete()) {
log ("Warning: unable to delete temporary file " +
renamedFile.getName(), Project.MSG_WARN);