Introduction to INI files
INI files are a collection of configuration switches that can be used to control
the behaviour of a program. They are used in Exponential 3 to control everything from
access control to site design.
How they work
Each switch or key consists of a key name and a key value.
Each key is placed in a group to avoid name conflicts and to make the file more
structured. The INI file is line based, which means that a group name and a key
entry exists on a single line. Empty lines are ignored as well as lines beginning
with a # (hash) which start a single line comment.
A group is entered by placing square brackets [ and ] around the group name.
[MyGroup]
A key is entered by adding a = (equal sign) between the key name and the key value.
MyKey=my value
Keys are generally seen as strings, however it's possible to create simple lists by separating
items in the value with a semi-colon ;. The value will still be read as a
string but may be interpreted as a list by the developer.
MyKey=item1;item2;item3
Group names and key names are case sensitive and may contain any characters except the equal sign. *
Group names and key names will have their whitespace trimmed before and after
the name while key values will keep all their whitespace.
Charsets
All INI files are read as they were written using the utf8 (Unicode) charset,
if however you want the file to be in another charset format you can specify
it at the beginning of the file with a special comment syntax that defines
INI attributes.
#?ini charset=iso-8859-1?
All text within the ?ini and the ending ? is seen as a list of key/value
pairs and is separated with spaces, the key and value is separated with a = (equal sign).
For now only the attribute charset is used.
Overrides
In Exponential 3 all INI files can be overridden, this means that it's possible to
change configuration without modifying the original files. Two types of override is possible,
the first is overriding the whole file and second is append mode where you can override
existing keys or add new ones. The latter is probably the most useful one.
The override file is placed in the override directory which usually is override.
It mirrors the original ini directory. This means that an override for the file site.ini
would be called either override/site.ini or override/site.ini.append.
Example
Full example of an INI file
# This is comment and is ignored
# The next empty lines are also ignored
[Group1]
Key1=some value
Key2=42
[Group2]
Key1=some value, again
Key2=array;values;here
[Group3]
Key1=some value, third time
|