MozillaZine

Impossible to remove a file in Windows?

Talk about add-ons and extension development.
dangbat
 
Posts: 14
Joined: December 18th, 2002, 1:00 am

Post Posted February 1st, 2003, 9:36 am

Ok, I'm using Windows 2000.

var aFile = Components.classes["@mozilla.org/file/local;1"].createInstance();
var aLocalFile = aFile.QueryInterface(Components.interfaces.nsILocalFile);
fPath = "c:\\temp\\test.txt";
/* file exists. Before the following lines, I have created, opened, written, and read from it without a problem. */
aLocalFile.initWithPath(fPath);
aLocalFile.remove(true);

Why can't I delete the blasted thing? whether I use remove(true) or false, still get an error, and the file refuses to be deleted. Anyone have a solution for this?

Thanks
-D

agamid
 
Posts: 190
Joined: January 16th, 2003, 9:32 pm

Post Posted February 3rd, 2003, 2:24 pm

I don't know what your problem is, but sometimes when I use windows and I get the cannot delete file problem... and I can't figure it out, I reboot my machine and that usually works. it's not always about file locking. sometimes, it stays locked?? even after the app is closed.

RAF
Moderator

User avatar
 
Posts: 12606
Joined: November 5th, 2002, 2:19 pm
Location: .nl

Post Posted February 3rd, 2003, 2:54 pm

OT: Agamid,

I have the same problem in W2K. Killing explorer.exe in Task Manager works.

mboullet
 
Posts: 337
Joined: November 5th, 2002, 2:34 am
Location: France

Post Posted February 3rd, 2003, 4:26 pm

I think that the only files you can delete through XPCOM must be located in the chrome directory.

Even this, I'm not sure. For example in TBE, Piro's exUnregistere.js is unable to remove
the TBE.jar file.

For security reasons, obviously.
Marc

agamid
 
Posts: 190
Joined: January 16th, 2003, 9:32 pm

Post Posted February 4th, 2003, 12:59 am

RAF wrote:OT: Agamid,

I have the same problem in W2K. Killing explorer.exe in Task Manager works.


what's OT?

RAF
Moderator

User avatar
 
Posts: 12606
Joined: November 5th, 2002, 2:19 pm
Location: .nl

Post Posted February 4th, 2003, 1:03 am

OT = off topic.
Because it had nothing to do with the original post.

mboullet
 
Posts: 337
Joined: November 5th, 2002, 2:34 am
Location: France

Post Posted February 7th, 2003, 3:49 pm

Another not confirmed idea:
Maybe you need a signed script to perform the delete operation.

Anyway, if you find the solution, let us know.
Marc

Return to Extension Development


Who is online

Users browsing this forum: No registered users and 3 guests