How enlightening! Since I'm ignorant of JavaScript, I wonder the difference,
if any, between the two constructs below?
filelist = filelist + filename;
filelist = filelist.concat(',');
Could it have been too:
filelist = filelist.concat(filename);
filelist = filelist + ',';
Is it the same kind of things than in Java with:
filelistString = filelistString + filename;
filelistStringBuffer.append(filename);
where the second form is more efficient. Little of topic, but I was just
wondering ;-) --DD
-----Original Message-----
From: Diane Holt [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 26, 2002 4:32 PM
To: Ant Users List
Subject: RE: Trying to delete files not under source control
--- Steve Allan <[EMAIL PROTECTED]> wrote:
> I'm not able to go to 1.5 right now, but your example is still very
> instructive. And, since those dishes are taunting you, I'd love to see
> how it would done in javascript as well.
Contributing to my delinquency, huh? :) Here you go:
<target name="doit">
<exec executable="p4" outputproperty="p4files" vmlauncher="no">
<arg line='have | cut -d"-" -f2'/>
</exec>
<script language="javascript"> <![CDATA[
importClass(java.io.File);
importClass(java.util.StringTokenizer);
var filelist;
var fromStr = projname.getProperty("basedir");
var pathSep = projname.getProperty("path.separator");
var p4files = projname.getProperty("p4files");
var files = new StringTokenizer(p4files);
while (files.hasMoreTokens()) {
var f = files.nextToken();
/* Make sure we don't have separator stew */
var file = new File(f);
/* Now put it back into a string */
var path = new String(file);
var filename = path.substring(fromStr.length()+pathSep.length());
if(filelist == null) {
filelist = filename;
} else {
filelist = filelist + filename;
}
if(files.hasMoreTokens()) {
filelist = filelist.concat(',');
}
}
projname.setProperty("shipFilesPerforce", filelist);
]]>
</script>
<echo>shipFilesPerforce = ${shipFilesPerforce}</echo>
</target>
Diane
=====
([EMAIL PROTECTED])
__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>