Hi Lionel,
ImageJ checks the file path to avoid deleting files in
arbitrary directories. I am happy about this since it reduces
the risk of ImageJ Macros deleting everything on my harddisk.
(fortunately, I have not heard about ImageJ Macro viruses ;-)
See the sourcecode at
http://rsb.info.nih.gov/ij/developer/source/ij/macro/Functions.java.htmlWhat you could do is put the string "ImageJ" into the path, e.g.,
var todelete="/sim/spicy/ImageJ/save/1.txt";
Michael
________________________________________________________________
On 14 Feb 2007, at 16:40, Lionel Flandin wrote:
> Hin everyone,
>
> I would like to use the file.delete() macro, but could not get it
> to work.
> Here is an example of the code :
>
> var todelete="/sim/spicy/IJ/save/1.txt";
> if (File.exists(todelete)) {
> File.delete(todelete);
> print ("found and deleted");}
> else {print ("not found");}
>
> I get the following error : "File must be in imageJ home or temp
> directory in line 3".
>
> any idea ?
>
> Thanks in advance,
>
> Lionel