You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "Morten S. Mortensen" <mo...@tietoenator.com> on 2004/02/02 09:49:48 UTC

and names with spaces

Hi,

Trying out -

  <path
    id="sub-project.path"
  >

    <filelist
      dir="${project.dir}"
      files=
        "
         XXX Core Library/System/Java/build.xml,
         YYY Prime/System/Java/build.xml
        "
    />
  </path>

- I notice, that the "files" attributes *apparently* is not tokenized after a delimiter ',', because the first file-name becomes "XXX", not "XXX Core Library/System/Java/build.xml". 

An alternative to writing a <path> is -

  <path
    id="sub-project.path"
  >

    <pathelement location="XXX Core Library/System/Java/build.xml"/>
    <pathelement location="YYY Prime/System/Java/build.xml"/>

  </path>

- and this works well for the specific example, but then I in general loose the control of the sequence of names, because they are sorted - with <filelist>, I have this control!

This is less than optimal. In general, lists manifestated in the form of comma-separated sucks!

The in-ability of <filelist>'s handling of file-names with internal spaces is a glitch, right?

Regards,
Morten Sabroe Mortensen 


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


Re: and names with spaces

Posted by Peter Reilly <pe...@corvil.com>.
Morten S. Mortensen wrote:

>Hi,
>
>Trying out -
>
>  <path
>    id="sub-project.path"
>  >
>
>    <filelist
>      dir="${project.dir}"
>      files=
>        "
>         XXX Core Library/System/Java/build.xml,
>         YYY Prime/System/Java/build.xml
>        "
>    />
>  </path>
>
>- I notice, that the "files" attributes *apparently* is not tokenized after a delimiter ',', because the first file-name becomes "XXX", not "XXX Core Library/System/Java/build.xml". 
>
>An alternative to writing a <path> is -
>
>  <path
>    id="sub-project.path"
>  >
>
>    <pathelement location="XXX Core Library/System/Java/build.xml"/>
>    <pathelement location="YYY Prime/System/Java/build.xml"/>
>
>  </path>
>
>- and this works well for the specific example, but then I in general loose the control of the sequence of names, because they are sorted - with <filelist>, I have this control!
>  
>
You are correct that filelist restriction to only using an attributes is 
wrong. (and easy to fix).
However the elements of a path are not sorted - (although duplicates are 
removed).

    <echo>Order A</echo>
    <ac:for param="file">
      <ac:path>
        <ac:pathelement location="path.xml"/>
        <ac:pathelement location="build.xml"/>
      </ac:path>
      <ac:sequential>
        <echo>File: @{file}</echo>
      </ac:sequential>
    </ac:for>
    <echo>Order B</echo>
    <ac:for param="file">
      <ac:path>
        <ac:pathelement location="build.xml"/>
        <ac:pathelement location="path.xml"/>
      </ac:path>
      <ac:sequential>
        <echo>File: @{file}</echo>
      </ac:sequential>
    </ac:for>

outputs:
order:
Order A
File: /home/preilly/learning/ant/path.xml
File: /home/preilly/learning/ant/build.xml
Order B
File: /home/preilly/learning/ant/build.xml
File: /home/preilly/learning/ant/path.xml

>This is less than optimal. In general, lists manifestated in the form of comma-separated sucks!
>
>The in-ability of <filelist>'s handling of file-names with internal spaces is a glitch, right?
>  
>
Yes,
with the attached patch one should be able to specify filelists like:

  <filelist dir="${project.dir}">
    <file name="XXX Core Library/System/Java/build.xml"/>
    <file name="YYY Prime/System/Java/build.xml"/>
  </filelist>


Peter