ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "W. Sean Hennessy" <shenne...@goldenhourdata.com>
Subject RE: Problem with deleting a file inside javascript
Date Wed, 04 Jun 2003 15:24:31 GMT
try using the constructor with your language="javascript".
tFile = new File("test.txt");
and see if your mileage varies.


-----Original Message-----
From: Manoj Sadangi [mailto:msadangi@manh.com]
Sent: Wednesday, June 04, 2003 7:40 AM
To: 'Ant Users List'
Subject: RE: Problem with deleting a file inside javascript


I will use one of these
thanks, 
manoj 



-----Original Message-----
From: peter reilly [mailto:peter.reilly@corvil.com]
Sent: Wednesday, June 04, 2003 10:39 AM
To: Ant Users List
Subject: Re: Problem with deleting a file inside javascript


looks like "delete" is a keyword in javascript (or rhino)
use jython/jpython or beanshell
<script language="javascript"> <![CDATA[ 
importClass(java.io.File);
        f = File("test.txt");
        fsize = f.length();
       if(fsize <= 15)
        {
          f.canRead();  // delete does not work here
        }  
]]> </script>
<script language="beanshell"> <![CDATA[ 
import java.io.File;
        f = new File("test.txt");
        fsize = f.length();
       if(fsize <= 15)
        {
          f.delete();      
        }  
]]> </script>
<script language="jython"> <![CDATA[ 
from java.io import File
f = File("test.txt");
fsize = f.length();
if fsize <= 15:
    f.delete();      
]]> </script>

Peter
On Wednesday 04 June 2003 15:02, Manoj Sadangi wrote:
> How can I delete a file inside javascript?
> This is throwing error in the line f.delete() "missing name after .
> operator"
> <script language="javascript"> <![CDATA[
> importClass(java.io.File);
>         f = File("test.txt");
>         fsize = f.length();
>        if(fsize <= 15)
>         {
>           f.delete();
>         }
> ]]> </script>
>
> thanks,
> manoj
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


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

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




Mime
View raw message