From 2bdf958cfde7d77348b9a043ce093c2b1813be89 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Mon, 10 Mar 2003 07:36:45 +0000 Subject: [PATCH] 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 --- .../tools/ant/types/AbstractFileSet.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/types/AbstractFileSet.java b/src/main/org/apache/tools/ant/types/AbstractFileSet.java index 060c710d6..c460a4722 100644 --- a/src/main/org/apache/tools/ant/types/AbstractFileSet.java +++ b/src/main/org/apache/tools/ant/types/AbstractFileSet.java @@ -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(); + } + }