ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Trying to delete files not under source control
Date Fri, 26 Apr 2002 21:44:33 GMT
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:holtdl@yahoo.com] 
Sent: Friday, April 26, 2002 4:32 PM
To: Ant Users List
Subject: RE: Trying to delete files not under source control

--- Steve Allan <stevea@wrq.com> 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

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/

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

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


Mime
View raw message