I've tried to create a symlink like:
<symlink link="${basedir}/docroot" resource="${basedir}/drupal-7.*" overwrite="true"/>
however, the line doesn't expand the wildcard but creates a link which points literally to drupal-7.*
, not to drupal-7.56
.
I've tried to use examples with fileset
on this page, but it doesn't really cover my scenario.
How can I create an Ant's symlink which points to a dynamic folder (the one expanded by drupal-7.*
)?
You should use dirset
instead of fileset
to include directories, not files. Also, it would probably be a good idea to check for an unexpected number of directories as well.
Here is the example:
<dirset dir="${basedir}" includes="drupal-7.*" id="link.target" />
<fail message="Multiple or zero drupal-7.* directories found.">
<condition>
<not>
<resourcecount refid="link.target" when="equal" count="1" />
</not>
</condition>
</fail>
<symlink link="${basedir}/docroot" resource="${toString:link.target}" />