From 2f05511dfc846364ee8dde46cb8256204176e639 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 29 Nov 2005 04:34:01 +0000 Subject: [PATCH] make Project a resource factory for convenience git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@349626 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/Project.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/Project.java b/src/main/org/apache/tools/ant/Project.java index c406e7b0e..3c15ca214 100644 --- a/src/main/org/apache/tools/ant/Project.java +++ b/src/main/org/apache/tools/ant/Project.java @@ -41,6 +41,9 @@ import org.apache.tools.ant.types.FilterSet; import org.apache.tools.ant.types.FilterSetCollection; import org.apache.tools.ant.types.Description; import org.apache.tools.ant.types.Path; +import org.apache.tools.ant.types.Resource; +import org.apache.tools.ant.types.ResourceFactory; +import org.apache.tools.ant.types.resources.FileResource; import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.JavaEnvUtils; import org.apache.tools.ant.util.StringUtils; @@ -56,7 +59,7 @@ import org.apache.tools.ant.util.StringUtils; * file paths at runtime. * */ -public class Project { +public class Project implements ResourceFactory { /** Message priority of "error". */ public static final int MSG_ERR = 0; /** Message priority of "warning". */ @@ -2187,4 +2190,13 @@ public class Project { // is private/protected. } } + + /** + * Resolve the file realtive to the project's basedir and return it as a + * FileResource. + * @since Ant 1.7 + */ + public Resource getResource(String name) { + return new FileResource(getBaseDir(), name); + } }