Hi Tomas,

Unfortunately, the error code does mean that the code has not been written to save properties out to disk.

Darin



Tomas Rollo wrote:

Hello to everybody,

I'm starting to write my first mozilla-based application to learn XUL/JS/XPCOM use etc. and I have found following problem:

I have written a wrapper-like class for dealing with properties, but when I call nsIPersistentProperties.save method of nsIPersistentProperties, I'm getting this exception:

[Exception... "Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIPersistentProperties.save]" nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame :: chrome://jam/content/class.Props.js :: anonymous :: line 28" data: no]

Does that mean that the method is not implemented yet or am I doing something foolish? Here's the class code's snippet:

function Props() {
this.fileName = "e:\jam.properties"; //local filename of the properties file
try {
this.properties = Components.classes["@mozilla.org/persistent-properties;1"].createInstance(Components.interfaces.nsIPersistentProperties);


    } catch (e) {
        alert("Got an exception: "+e.toString());
    }
}

Props.prototype.saveProps = function() {
try {
file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);


file.initWithPath(this.fileName);
outStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);


outStream.init(file,0x01,0644,null);
this.properties.save(outStream,"JAM Settings"); //this is the line generating the exception
inStream.close();
} catch (e) {
alert("Got an exception: "+e.toString());
}
}


Thanks to everybody aiming me the right way.

Tomas R.

_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to