ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bailey, Darragh" <dbai...@hp.com>
Subject RE: Trouble with <copy> and <DirSet>
Date Fri, 10 Sep 2010 16:04:04 GMT

> -----Original Message-----
> From: Aaron Mackley [mailto:Aaron.Mackley@dtint.com] 
> Sent: 10 September 2010 15:40
> To: user@ant.apache.org
> Subject: RE: Trouble with <copy> and <DirSet>
> 
> Stefan,

<snip>

> I currently have this code: (I am trying to copy prefs.js to 
> the random
> directory *.default.)
> 
> <copy todir="${firefox.dir}">
> 	<dirset dir="${firefox.dir}">
> 		<include name="**/*.default"/>
> 	</dirset>
> 	<fileset dir="${apps.dir}/Firefox">
> 		<include name="prefs.js"/>
> 	</fileset>
> </copy>
> 
> 
> 
> Is this the right way to go about this?

That would attempt to copy the xxxxxxxxx.default directory to the firefox directory.

There was a thread a week ago titled "How to get the last folder name?" which should solve
this problem for you.

> I want to get the path to the last child folder in some parent 
> directory. Tried this:
> 
>          <path id="_lastname">
>              <last>
>                  <sort>
>                      <fileset dir="C:\my\parent"/>
>                  </sort>
>              </last>
>          </path>
>          <property name="_lastname2" location="${_lastname}"/>


The person had one mistake that was corrected by Matt Benson, he should have used "${toString:_lastname}"
in order to convert to a property.

So your code would become something like the following:

<path id="path.firefox.default.profile">
  <dirset dir="${firefox.dir}">
    <!-- 
       I'm assumming that to avoid getting a directory below 
       the profile directory, that sort will return the results 
       in the order of the shortest path.
    -->
    <first>
      <sort>
        <include name="**/*.default" />
      </sort>
    </first>
  </dirset>
</path>

<property name="firefox.default.profile.dir" location="${toString:path.firefox.default.profile}"
/>

<copy todir="${firefox.default.profile.dir}" >
  <fileset dir="${apps.dir}/Firefox" >
    <include name="prefs.js" />
  </fileset>
</copy>


This is untested and just constructed based on the person saying that it worked after making
the changes suggested.


--
Regards,
Darragh Bailey

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


Mime
View raw message