ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Burton" <bi...@progress.com>
Subject Re: Refactor of PathTokenizer - am I missing something?
Date Fri, 04 Jan 2002 01:06:34 GMT
Hi Jeff,

I think I now have a better understanding of the problem ...

Jeff Tulley wrote:
> 
> Bill,
>     One thing that you are missing here is the fact that it is not a
> build file directly that is triggering this problem, at least not in the
> sense of the <path>, <classpath>,  and <pathelement> tags.  What is
> actually giving me grief is a <javadoc> task that uses PathTokenizer.

Okay, I didn't realize <javadoc> was the culprit.

>     It seems that I should support UNIX path names, since our OS has a
> file mode that would allow you to reference our volumes in a UNIX-like
> manner.  (instead of sys:/temp, it would be /sys/temp, if I am not
> mistaken).

Okay, I didn't realize you could specify a NetWare volume with /vol/path
syntax.  I'm assuming that's exposed to the JVM?

Here's another take at the problem.  Both ";" and ":" are supported
depending on whether a ";" is found anywhere in the path but not both
together.  Of course, the one limitation is the assumption that a filename
or directory can't contain a ";":

    public PathTokenizer(String path) {
        String tokens = ":;";
        // When running under NetWare, look for a ";" anywhere in the
path.  If not
        // found, assume a UNIX style path and use ":", otherwise use ";"
as the
        // delimiter.
        if ( null != path && Os.isFamily("netware") ) {
            tokens = ( path.indexOf(';') == -1 ) ? ":" : ";";
        }
        tokenizer = new StringTokenizer(path, tokens, false);
        dosStyleFilesystem = File.pathSeparatorChar == ';';
    }

All of the following paths should be tokenized properly:
    sys:/temp;sys:\public
    temp;public
    /sys/temp:/sys/public
    ./temp:./public

Hope this helps,
-Bill

--
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