ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <peter.rei...@corvil.com>
Subject Re: Problem with deleting a file inside javascript
Date Wed, 04 Jun 2003 14:39:11 GMT
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


Mime
View raw message