This interface provides methods that allow writing to INI-format configuration files. INI files contain zero or more sections, denoted by a name in square brackets, followed by zero or more lines of text with a property name on the left, then an equals sign ("="), then the value of the property.
let writer = Components.classes["@mozilla.org/xpcom/ini-processor-factory;1"]. .getService(Components.interfaces.nsIINIParserFactory) .createINIParser(someLocalFile) .QueryInterface(Components.interfaces.nsIINIParserWriter);
Once the writer object is created, you can use the
setString() method to set the value of a property within a given section; the section is created if it hasn't been yet.
The sections are built in memory before the text of the INI file is generated, so you can add properties to the file in any order, regardless of section.
When you're done and ready to write the INI file to disk, call the
These constants are specified when calling
writeFile(), in order to change its behavior.
||Windows and the
Set the value of a property string for a particular section and key.
void setString( in AUTF8String aSection, in AUTF8String aKey, in AUTF8String aValue );
- The name of the section into which to place the property.
- The name of the property for which the value is to be set.
- The value to assign to the property.
Write to the INI file.
void writeFile( in nsIFile aINIFile, Optional in unsigned long aFlags Optional );