ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Javier Pavier" <>
Subject Convert fileset into command-line args, allowing for spaces in directories
Date Mon, 23 Jan 2006 13:01:29 GMT
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)}"/>

    <!-- 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)}"/>

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 

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}"/>

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!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message