Bug 17781 - name attribute of record task is not relative to basedir
Summary: name attribute of record task is not relative to basedir
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.5
Hardware: PC All
: P3 enhancement with 3 votes (vote)
Target Milestone: ---
Assignee: Ant Notifications List
: 23563 (view as bug list)
Depends on:
Reported: 2003-03-07 17:55 UTC by Marius Scurtescu
Modified: 2008-11-24 03:57 UTC (History)
2 users (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Marius Scurtescu 2003-03-07 17:55:12 UTC
The 'name' attribute of the 'record' task is specifying a file name and this
file name is relative to the current folder and not to the 'basedir' of the project.

If the build file is run by some other tool (like Antelope) then the current
folder is not even the folder where the build file is.

The 'name' attribute probably should be relative to the project 'basedir' (as
difined in the 'project' root tag), the same way the 'echoproperties' optional
tag works for example.
Comment 1 Stefan Bodewig 2003-09-25 13:36:58 UTC
You are correct, that name should resolve relative files as most other tasks do.

Unfortunately if we change current behavior, we may break existing code, so we
can't.  What we could do, was implementing an additional attribute with the
correct behavior.

As a workaround, you can prepend ${basedir} to the value of your name attribute.
Comment 2 Stefan Bodewig 2003-10-02 12:21:26 UTC
*** Bug 23563 has been marked as a duplicate of this bug. ***
Comment 3 Jan Mat 2003-10-02 12:56:51 UTC
I played a little bit with that. An additional file-attribute would help.
But I have to search for a solution for getting the right name from the file.

    <record file="logs/log.txt" action="start" />
    <record name="logs/log.txt" action="stop" />  		  	
Both should use the same recorder. But file is a java.io.File and set by Ant 
with an absolute value (e.g. /home/test/logs/log.txt). So I have to get the 
relative part (/home/test = basedir). But the problem is: what if I set the 
file value to an absolute value by myself?
  	<record file="/logs/antlogs/logs/log.txt" action="start" />