Ok, what's wrong with this?
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var filePath = "c:\test.txt";
var obj_TargetFile =
Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
obj_TargetFile.initWithPath(filePath);
// Here, I get a NS_ERROR_FILE_NOT_FOUND
try { alert(obj_TargetFile.fileSize);} catch(e) { alert(e); }
// And here, I get a NS_ERROR_FILE_ALREADY_EXISTS
if(!obj_TargetFile.exists()) { try {
obj_TargetFile.create(0x00,0644); } catch (e) { alert(e); } }
// And this returns a false
alert(obj_TargetFile.exists());
Now, come on. I shouldn't be getting those two errors together.
After all, if the file isn't found, it obviously should be possible to
create it, and if it already exists (and it does), then it should
obviously be found.
What am I doing wrong? I'm using Windows2000, Phoenix 0.5, and I do
have full access to the test.txt file, I'm going with full
administrator rights. I know I must be missing something obvious, but
I can't really see what it is.
Thank you in advance for any help,
-mccrowe