ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <j_a_fernan...@yahoo.com>
Subject Re: Refactor of PathTokenizer - am I missing something?
Date Wed, 02 Jan 2002 23:05:50 GMT
From: "Conor MacNeill" <conor@cortexebusiness.com.au>

> Jeff,
> 
> > Yes, that is the whole class.  So, I'm thinking - it is so simple that
> > I must be missing something.
> 
> What you are missing is the fact that build files are platform independent.
> If I take a build file with a unix-style colon separated path, it should
> continue to work on a Window's system. The converse is also true. Your
> change would completely break that if I understand it correctly. In other
> words, not only is the code platform independent but so is the treatment of
> the data.
> 

I agree and disagree, here. 
The current implementation is not only OS dependent, but it restricts the kind of file names
that
can be used on each OS system. A king of least common denominator.

True, buildfiles should be OS independent as long as they do not use OS dependent syntax or
things.

For example, a buildfile that uses <exec executable="foo.exe" .../>
will most probably not work on UNIX OSes. To certain extend the same
applies for paths. If you define paths using the concatenation of
the locations using ";" or ":" ("xyz.jar;abc/www") then you are writing OS dependent buildfiles.
People should use:

    <path id="mypath" >
        <pathelement location="xyz.jar" />
        <pathelement location="abc/www" />
    </path>

The usage of <pathelement path="${thepath}" /> should be limited to
refer to properties whose values come from the operating system, like java.class.path
or when the value is computed by ANT itself, like when passing arguments in <ant>:

    <ant .....>
        <property name="path" refid="mypath" />
    </ant>

Here ANT will set the property to the toString() value of the path reference using
the correct representation for the OS being executed.

Jose Alberto



--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message