Bug 23563 - Ant's "record" task use current user dir as the log file's base path
Summary: Ant's "record" task use current user dir as the log file's base path
Status: RESOLVED DUPLICATE of bug 17781
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.5.4
Hardware: All All
: P3 minor (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-02 12:03 UTC by chenlei
Modified: 2008-02-22 12:18 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description chenlei 2003-10-02 12:03:46 UTC
Ant's record task use current user dir to get the true file path.
While not use the project's base dir to get the true file path.

This is my test build xml file under "d:\MyProject"

<project name="MyProject" default="test" basedir=".">
  <target name="test">
  	<delete dir="logs" />
  	<mkdir dir="logs"/>  	
  	<record name="logs/log.txt" action="start" />
  	<record name="logs/log.txt" action="stop" />  		  	
  </target>
</project>

When run ant use "cd d:\ ; ant -buildfile d:\MyProject\build.xml", it could 
delete and create "logs" dir under "MyProject" successfully. But it report 
error and want to build a log file at "d:\logs". This cause the ant build 
file's failure even when using ANT API and in eclipse IDE.
Comment 1 Jan Mat 2003-10-02 12:19:18 UTC
Confirmed with actual cvs head (1.7alpha) on Win2K, JDK 1.4.2.

Recorder.setName() takes a String as argument not a File. Therefore the 
relative name is kept here.

Recorder.getRecorder() uses that name as argument for getting one from its 
hashtable or creating a new one. After creating the output stream is set by
>>new PrintStream(new FileOutputStream(name))<<. 


I try some modifications.
Comment 2 Stefan Bodewig 2003-10-02 12:21:24 UTC

*** This bug has been marked as a duplicate of 17781 ***
Comment 3 Stefan Bodewig 2003-10-02 12:23:26 UTC
Certainly not a Blocker (simply use name="${basedir}/..." as a workaround).

Changing the interpretation of the name attribute would break backwards
compatibility.