stevel      2003/03/09 23:36:46

  Modified:    src/main/org/apache/tools/ant/types AbstractFileSet.java
  Log:
  implementing bug 12060: provide a toString operator
  so that turning into a property is mildly meaningful.
  
  We dont include base dir info, so you get a list of
  files relative to the basem, all with a ; separator.
  
  Revision  Changes    Path
  1.16      +20 -1     
ant/src/main/org/apache/tools/ant/types/AbstractFileSet.java
  
  Index: AbstractFileSet.java
  ===================================================================
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/types/AbstractFileSet.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- AbstractFileSet.java      7 Mar 2003 11:23:07 -0000       1.15
  +++ AbstractFileSet.java      10 Mar 2003 07:36:45 -0000      1.16
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -623,6 +623,25 @@
        */
       public void addDepend(DependSelector selector) {
           appendSelector(selector);
  +    }
  +
  +    /**
  +     * Returns included files as a list of semicolon-separated filenames
  +     *
  +     * @return String object with included filenames
  +     */
  +    public String toString() {
  +        DirectoryScanner ds = getDirectoryScanner(getProject());
  +        String[] files = ds.getIncludedFiles();
  +        StringBuffer sb = new StringBuffer();
  +
  +        for (int i = 0; i < files.length; i++) {
  +            if (i>0) {
  +                sb.append(';');
  +            }
  +            sb.append(files[i]);
  +        }
  +        return sb.toString();
       }
   
   }
  
  
  

Reply via email to