return;
}
log("Building tar: " + tarFile.getAbsolutePath(), Project.MSG_INFO);
TarOutputStream tOut = null;
try {
tOut = new TarOutputStream(
compression.compress(
new BufferedOutputStream(
new FileOutputStream(tarFile))));
tOut.setDebug(true);
if (longFileMode.isTruncateMode()) {
tOut.setLongFileMode(TarOutputStream.LONGFILE_TRUNCATE);
} else if (longFileMode.isFailMode() ||
longFileMode.isOmitMode()) {
tOut.setLongFileMode(TarOutputStream.LONGFILE_ERROR);
} else {
// warn or GNU
tOut.setLongFileMode(TarOutputStream.LONGFILE_GNU);
}
longWarningGiven = false;
for (Enumeration e = filesets.elements();
e.hasMoreElements();) {
TarFileSet fs = (TarFileSet) e.nextElement();
String[] files = fs.getFiles(getProject());
if (files.length > 1 && fs.getFullpath().length() > 0) {
throw new BuildException("fullpath attribute may only "
+ "be specified for "
+ "filesets that specify a "
+ "single file.");
}
for (int i = 0; i < files.length; i++) {
File f = new File(fs.getDir(getProject()), files[i]);
String name = files[i].replace(File.separatorChar, '/');
tarFile(f, tOut, name, fs);
}
}
} catch (IOException ioe) {
String msg = "Problem creating TAR: " + ioe.getMessage();
throw new BuildException(msg, ioe, location);
} finally {
if (tOut != null) {
try {
// close up
tOut.close();
} catch (IOException e) {}
}
}
} finally {
filesets = savedFileSets;