cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Sparkes <pe...@didm.co.uk>
Subject Flowscript - delete file
Date Thu, 27 Dec 2012 09:28:31 GMT
Hi,

I am trying to delete xml files using the following flowscript:

    function deletefile() {

         //file to be deleted
         var file = Packages.java.lang.String(cocoon.parameters["file"]);

         try {
             // creating a link to the file to be deleted
             var xml_file = Packages.java.io.File("D:\cocoon-2.1.11-wl\build\webapp\B&B\xml"
+ file
    + ".xml");

             //Delete file
             Packages.java.io.File.xml_file.delete();

             //  .txt file with OK message
             cocoon.sendPage("success.txt", null);
         }
         catch(ex){
             cocoon.log.error(ex);
             // Smth. went wrong. Sending a error.txt file to the browser
           cocoon.sendPage("error.txt", null);
         }

    }

and get "Compilation produced 1 syntax errors"

The error log contains:

    ERROR ............    deletefile.js", line 13: missing name after . operator

line 13 is:

    Packages.java.io.File.xml_file.delete();

What I am doing wrong?

Peter


Mime
View raw message