Index: Expand.java =================================================================== RCS file: /home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/Expand.java,v retrieving revision 1.49 diff -u -w -r1.49 Expand.java --- Expand.java 13 Aug 2003 14:46:15 -0000 1.49 +++ Expand.java 10 Dec 2003 02:24:23 -0000 @@ -98,6 +98,7 @@ private static final String NATIVE_ENCODING = "native-encoding"; private String encoding = "UTF8"; + private boolean ignoreRootFiles = false; /** * Do the work. @@ -236,6 +237,16 @@ return; } } + //Root listing fix, if the entry name is starting with / (root folder) + //and we are not expanding to the root, then treat this as relative + //havent tested on windows + if ( ignoreRootFiles ) { + if (!dir.getAbsolutePath().equals(File.separator) && + entryName.startsWith(File.separator)) { + entryName = entryName.substring(1); + } + } + //End fix File f = fileUtils.resolveFile(dir, entryName); try { if (!overwrite && f.exists() @@ -343,4 +354,17 @@ this.encoding = encoding; } + /** + * If set to true, this file will ignore the root character + * and expand the file into the destination folder even though the + * filepath in the jar is /file.txt + * @return boolean + */ + public boolean getIgnoreRootFiles() { + return ignoreRootFiles; + } + public void setIgnoreRootFiles(boolean ignoreRootFiles) { + this.ignoreRootFiles = ignoreRootFiles; + } + }