Browse Source

Defer sanity checks of dir attribute to the point where the fileset

will be used for the first time. This will enable things like

<project default="main">
  <fileset dir="tmp" id="tmpfiles">

  <target name="prep">
    <mkdir dir="tmp" />
  </target>

  <target name="main" depends="prep">
    <copy todir="foo">
      <fileset refid="tmpfiles" />
    </copy>
  </target>
</project>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268830 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
b0f1f9cab7
2 changed files with 11 additions and 6 deletions
  1. +4
    -0
      WHATSNEW
  2. +7
    -6
      src/main/org/apache/tools/ant/types/FileSet.java

+ 4
- 0
WHATSNEW View File

@@ -29,6 +29,10 @@ Fixed bugs:
* <delete includeemptydirs="true"> now deletes more than just the leaf
directories.

* You can now specify a <fileset> for a directory that doesn't exist at
declaration time but will created before the fileset gets used for the
first time.

Changes from Ant 1.2 to Ant 1.3
===========================================



+ 7
- 6
src/main/org/apache/tools/ant/types/FileSet.java View File

@@ -116,12 +116,6 @@ public class FileSet extends DataType {
throw tooManyAttributes();
}

if (!dir.exists()) {
throw new BuildException(dir.getAbsolutePath()+" not found.");
}
if (!dir.isDirectory()) {
throw new BuildException(dir.getAbsolutePath()+" is not a directory.");
}
this.dir = dir;
}

@@ -242,6 +236,13 @@ public class FileSet extends DataType {
throw new BuildException("No directory specified for fileset.");
}

if (!dir.exists()) {
throw new BuildException(dir.getAbsolutePath()+" not found.");
}
if (!dir.isDirectory()) {
throw new BuildException(dir.getAbsolutePath()+" is not a directory.");
}

DirectoryScanner ds = new DirectoryScanner();
setupDirectoryScanner(ds, p);
ds.scan();


Loading…
Cancel
Save