From 01a69e59feb9cb7c87829516bce61156ad180a6c Mon Sep 17 00:00:00 2001 From: Diane Holt Date: Mon, 1 Apr 2002 05:41:30 +0000 Subject: [PATCH] If 'output' is a simple or relative filename, make it relative to ${basedir}, not ${user.dir}. (If it's a full-path, it'll go to the full-path file.) (PR 4548) git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272144 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/taskdefs/Ant.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Ant.java b/src/main/org/apache/tools/ant/taskdefs/Ant.java index 131211ef1..e960337d1 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Ant.java +++ b/src/main/org/apache/tools/ant/taskdefs/Ant.java @@ -104,7 +104,8 @@ public class Ant extends Task { private String target = null; /** the output */ - private String output = null; + private String output = null; + private String outfile = null; /** should we inherit properties from the parent ? */ private boolean inheritAll = true; @@ -174,8 +175,12 @@ public class Ant extends Task { } if (output != null) { + if (dir != null) { + File file = FileUtils.newFileUtils().resolveFile(dir, output); + outfile = file.getAbsolutePath(); + } try { - PrintStream out = new PrintStream(new FileOutputStream(output)); + PrintStream out = new PrintStream(new FileOutputStream(outfile)); DefaultLogger logger = new DefaultLogger(); logger.setMessageOutputLevel(Project.MSG_INFO); logger.setOutputPrintStream(out);