git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274099 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -79,6 +79,9 @@ public class Resource implements Cloneable { | |||||
| * only sets the name. | * only sets the name. | ||||
| * | * | ||||
| * <p>This is a dummy, used for not existing resources.</p> | * <p>This is a dummy, used for not existing resources.</p> | ||||
| * | |||||
| * @param name relative path of the resource. Expects | |||||
| * "/" to be used as the directory separator. | |||||
| */ | */ | ||||
| public Resource(String name) { | public Resource(String name) { | ||||
| this(name, false, 0, false); | this(name, false, 0, false); | ||||
| @@ -86,11 +89,18 @@ public class Resource implements Cloneable { | |||||
| /** | /** | ||||
| * sets the name, lastmodified flag, and exists flag | * sets the name, lastmodified flag, and exists flag | ||||
| * | |||||
| * @param name relative path of the resource. Expects | |||||
| * "/" to be used as the directory separator. | |||||
| */ | */ | ||||
| public Resource(String name, boolean exists, long lastmodified) { | public Resource(String name, boolean exists, long lastmodified) { | ||||
| this(name, exists, lastmodified, false); | this(name, exists, lastmodified, false); | ||||
| } | } | ||||
| /** | |||||
| * @param name relative path of the resource. Expects | |||||
| * "/" to be used as the directory separator. | |||||
| */ | |||||
| public Resource(String name, boolean exists, long lastmodified, | public Resource(String name, boolean exists, long lastmodified, | ||||
| boolean directory) { | boolean directory) { | ||||
| this.name = name; | this.name = name; | ||||
| @@ -107,11 +117,17 @@ public class Resource implements Cloneable { | |||||
| * <p>example for a file with fullpath /var/opt/adm/resource.txt | * <p>example for a file with fullpath /var/opt/adm/resource.txt | ||||
| * in a file set with root dir /var/opt it will be | * in a file set with root dir /var/opt it will be | ||||
| * adm/resource.txt.</p> | * adm/resource.txt.</p> | ||||
| * | |||||
| * <p>"/" will be used as the directory separator.</p> | |||||
| */ | */ | ||||
| public String getName() { | public String getName() { | ||||
| return name; | return name; | ||||
| } | } | ||||
| /** | |||||
| * @param name relative path of the resource. Expects | |||||
| * "/" to be used as the directory separator. | |||||
| */ | |||||
| public void setName(String name) { | public void setName(String name) { | ||||
| this.name = name; | this.name = name; | ||||
| } | } | ||||
| @@ -66,7 +66,8 @@ public interface ResourceFactory { | |||||
| * Query a resource (file, zipentry, ...) by name | * Query a resource (file, zipentry, ...) by name | ||||
| * | * | ||||
| * @param Name relative path of the resource about which | * @param Name relative path of the resource about which | ||||
| * information is sought | |||||
| * information is sought. Expects "/" to be used as the | |||||
| * directory separator. | |||||
| * @return instance of Resource; the exists attribute of Resource | * @return instance of Resource; the exists attribute of Resource | ||||
| * will tell whether the sought resource exists | * will tell whether the sought resource exists | ||||
| */ | */ | ||||
| @@ -214,9 +214,6 @@ public class ZipScanner extends DirectoryScanner { | |||||
| return new Resource("", true, Long.MAX_VALUE, true); | return new Resource("", true, Long.MAX_VALUE, true); | ||||
| } | } | ||||
| // Zip-Entries always use forward slashes | |||||
| name = name.replace(File.separatorChar, '/'); | |||||
| // first check if the archive needs to be scanned again | // first check if the archive needs to be scanned again | ||||
| scanme(); | scanme(); | ||||
| if (myentries.containsKey(name)) { | if (myentries.containsKey(name)) { | ||||
| @@ -59,6 +59,7 @@ import org.apache.tools.ant.taskdefs.condition.Os; | |||||
| import org.apache.tools.ant.types.Resource; | import org.apache.tools.ant.types.Resource; | ||||
| import org.apache.tools.ant.types.ResourceFactory; | import org.apache.tools.ant.types.ResourceFactory; | ||||
| import java.io.File; | |||||
| import java.util.Vector; | import java.util.Vector; | ||||
| /** | /** | ||||
| @@ -111,14 +112,16 @@ public class SourceSelector { | |||||
| } | } | ||||
| String[] targetnames = | String[] targetnames = | ||||
| mapper.mapFileName(source[counter].getName()); | |||||
| mapper.mapFileName(source[counter].getName() | |||||
| .replace('/', File.separatorChar)); | |||||
| if (targetnames != null) { | if (targetnames != null) { | ||||
| boolean added = false; | boolean added = false; | ||||
| targetList.setLength(0); | targetList.setLength(0); | ||||
| for (int ctarget = 0; !added && ctarget < targetnames.length; | for (int ctarget = 0; !added && ctarget < targetnames.length; | ||||
| ctarget++) { | ctarget++) { | ||||
| Resource atarget = | Resource atarget = | ||||
| targets.getResource(targetnames[ctarget]); | |||||
| targets.getResource(targetnames[ctarget] | |||||
| .replace(File.separatorChar, '/')); | |||||
| // if the target does not exist, or exists and | // if the target does not exist, or exists and | ||||
| // is older than the source, then we want to | // is older than the source, then we want to | ||||
| // add the resource to what needs to be copied | // add the resource to what needs to be copied | ||||