[Project_owners] File Removal / Permissions errors

Brian King brian at mozdev.org
Thu Apr 20 19:33:14 EDT 2006

Working on Windows ... using the nsIFile/nsILocalFile interfaces.

I create a local directory like so:

if (!dir.exists())
    dir.create(0x01, 0755);

... which is fine, it's there. Then I add a file inside when writing a 
string to file:

outputStream.init( fileObj, 0x04 | 0x08 | 0x20, 0644, null );
result = outputStream.write( someText, someText.length );
delete outputStream;

... which is also fine, the file gets created/written to. But then I try 
and remove the file:


It throws this exception:
[Exception... "Component returned failure code: 0x80520015 
(NS_ERROR_FILE_ACCESS_DENIED) [nsILocalFile.remove]"

My first thought is that the application has a lock on it, but I can 
delete it manually.

So it looks like a file permission error. Any ideas?

Brian King
www.mozdev.org - free project hosting for the Mozilla community

More information about the Project_owners mailing list