Browse Source

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.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274215 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 23 years ago
parent
commit
2bdf958cfd
1 changed files with 20 additions and 1 deletions
  1. +20
    -1
      src/main/org/apache/tools/ant/types/AbstractFileSet.java

+ 20
- 1
src/main/org/apache/tools/ant/types/AbstractFileSet.java View File

@@ -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
@@ -625,4 +625,23 @@ public abstract class AbstractFileSet extends DataType implements Cloneable,
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();
}

}

Loading…
Cancel
Save