ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Javier Pavier" <javierpav...@hotmail.com>
Subject Convert fileset into command-line args, allowing for spaces in directories
Date Mon, 23 Jan 2006 13:01:29 GMT
Hi,
probably some obvious answer :-) but I cant find it.

I have a fileset, and i have a variable defining includes, and one defining 
excludes. The fileset is created like this. This works fine.

<fileset dir="${context.getVariable(dir_var_name)}" id="my.files">
    <!-- Includes -->
    <j:set var="include_var_name" value="my.fileset.include"/>
    <j:if test="${context.getVariable(include_var_name) != null}">
        <include name="${context.getVariable(include_var_name)}"/>
    </j:if>

    <!-- Excludes -->
    <j:set var="exclude_var_name" value="my.fileset.exclude"/>
    <j:if test="${context.getVariable(exclude_var_name) != null}">
        <exclude name="${context.getVariable(exclude_var_name)}"/>
    </j:if>
</fileset>

I now want to pass all of these files into a java task as command line args. 
I'm getting lots of problems whenever I have spaces in the directory or file 
names.

I've tried
<pathconvert pathsep=";" property="theCommandLineFiles" refid="my.files"/>
which will semicolon separate my files for me ... ok, but how do I then get 
these as command line args on a <java> task ?

<java classname="myApplication" failonerror="true" fork="true">

    ...

    <arg path="${theCommandLineFiles}"/>
</ant:java>

which passes them in with either : or ; as a separator (which isn't what I 
want). I need each file to be a separate argument to the application. Is 
there some way of iterating through the fileset or some other way of 
achieving this so that I get the spaces preserved in the arguments and the 
correct number of arguments etc.

Thanks in advance!

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message