From 4b56e099f28c2e7d47cf2408b07f97e6ede696fa Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 3 May 2001 12:27:52 +0000 Subject: [PATCH] Make sure, we don't add "" to the archive - zip has gotten the same special treatment a few weeks ago. PR: 1607 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269004 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/taskdefs/Tar.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Tar.java b/src/main/org/apache/tools/ant/taskdefs/Tar.java index 9ac6834c1..19556acc7 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Tar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Tar.java @@ -157,7 +157,6 @@ public class Tar extends MatchingTask { // add the main fileset to the list of filesets to process. TarFileSet mainFileSet = new TarFileSet(fileset); mainFileSet.setDir(baseDir); - mainFileSet.setDefaultexcludes(useDefaultExcludes); filesets.addElement(mainFileSet); } @@ -237,9 +236,16 @@ public class Tar extends MatchingTask { throws IOException { FileInputStream fIn = null; - if (file.isDirectory() && vPath.length() != 0 - && vPath.charAt(vPath.length() - 1) != '/') - vPath = vPath + "/"; + + // don't add "" to the archive + if (vPath.length() <= 0) { + return; + } + + if (file.isDirectory() && !vPath.endsWith("/")) { + vPath += "/"; + } + try { if (vPath.length() >= TarConstants.NAMELEN) { if (longFileMode.equalsIgnoreCase(OMIT)) {