I thought the following would work:
<!-- Gets the last modified date/time for a given file -->
<macrodef name="last-modified">
<attribute name="property" />
<attribute name="file" />
<sequential>
<script language="javascript">
file = project.resolveFile("@{file}");
project.setNewProperty("@{property}", file.lastModified());
</script>
</sequential>
</macrodef>
But it doesn't on Windows when used from within another <macrodef>:
<macrodef name="update-module-help">
<attribute name="name" />
<sequential>
<property name="@{name}.dest"
location="${helpzips}/[EMAIL PROTECTED]" />
<!-- Get the timestamp BEFORE <get> -->
<last-modified property="@{name}.ttprev" file="[EMAIL PROTECTED]" />
<!-- Possibly get a new updated help ZIP file -->
<get
src="${help.server}/@{name}_help/latest/[EMAIL PROTECTED]"
dest="${helpzips}/[EMAIL PROTECTED]"
usetimestamp="true"/>
<!-- Get the timestamp AFTER <get> -->
<last-modified property="@{name}.ttnext" file="[EMAIL PROTECTED]" />
<echo>@{name}.dest = [EMAIL PROTECTED]</echo>
<echo>@{name}.ttprev = [EMAIL PROTECTED]</echo>
<echo>@{name}.ttnext = [EMAIL PROTECTED]</echo>
<!-- Unzip only if the local help ZIP file changed -->
<if>
<not>
<equals arg1="[EMAIL PROTECTED]" arg2="[EMAIL PROTECTED]" />
</not>
<then>
<unzip src="${helpzips}/[EMAIL PROTECTED]"
dest="${SetupImage}/Help" />
</then>
<else>
<echo>Not modified - so not unzipped</echo>
</else>
</if>
</sequential>
</macrodef>
In the <last-modified> macro, when called from the other macro,
the file attribute has lost of its back-slashes '\'...
The attribute string somehow is interpreted, and all back-slashes
are meant to be escape characters, which are thus removed!
Very weird!!!
I could turn around the issue, thankfully, be using an intermediate
property. Not very pretty, and pollutes the caller's property-namespace,
but at least it works! Here's the turn around:
<!-- Gets the last modified date/time for a given file -->
<macrodef name="last-modified">
<attribute name="property" />
<attribute name="file" />
<sequential>
<property name="@{property}.file" location="@{file}" />
<script language="javascript">
filename = project.getProperty("@{property}.file");
file = project.resolveFile(filename);
project.setNewProperty("@{property}", file.lastModified());
</script>
</sequential>
</macrodef>
If that hadn't worked, I would have had to go with a Java tasks. --DD
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]