[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Many applications have an accompanying configuration file which describes configuration options specific to that application. Similarly, some plug-in modules have have a configuration file. Configuration files are named with the file extension `.cfg' and are typically located within the virtual directory `/config/' which is often mounted at the physical location `CS/data/config' for Crystal Space sample applications.
The format of these files is simple. They consist of a number of keys, each of which consists of a name, a value and an optional comment. Key names contain dots to create sort of hierarchy, similar to a file system: `Video.OpenGL.EnableDither'. This should be interpreted as the key `EnableDither' in the sub-section `OpenGL.', which resides in section `Video.' (note that the dots are part of the section names).
The file itself looks like this:
; This is the comment for Section.Keyname Section.Keyname = Value ; Comments may be ; several lines long ; The option 'Section.TestOption' has no comment attached to it. Video.OpenGL.EnableDither = true Section.TestOption = false ; Comments at the end of the file do not belong to any configuration ; key. When a config file is loaded and saved again later this ; end-of-file comment is put back at the end of the config file. |
When you run an application, all configuration domains are combined to one big database of options. When this happens, options from higher-priority domains override options from lower-priority domains. These domains are (from low to high priority):
System->Initialize(argc, argv, ConfigFile)
. This file
defines the default values for the application configuration, and can
override the configuration for plug-in modules if an application requires
this.
This domain is intended for users who want to override the configuration from the lower-priority domains explained above. This is an application-neutral domain, so any options you define here are used by all applications for the current user.
It is stored in a platform-dependent manner. See section 3.3 Platform-specific per-user configuration. The unique identifier is `CrystalSpace.Global'.
It is stored in a platform-dependent manner. See section 3.3 Platform-specific per-user configuration. The unique identifier is <ApplicationID>, where <ApplicationID> is defined in the user-neutral, application-specific configuration file (i.e. `walktest.cfg').
It is strongly recommended that an application identifier always have the form `<Producer>.<ProductName>'. If the application is a tool that is only meaningful if used together with CrystalSpace, or if you think your name is not worthy enough to be used in such an exposed place as the per-user configuration, you can also use something generic like `CrystalSpaceApp' or just `CrystalSpace' (the latter one is also used by CrystalSpace itself, so be wary of possible conflicts).
Thus you can set any option in your application's configuration file to override options from the plug-in configuration files. And you can also override those options via the user configuration.
If the application changes options in the configuration database, these changes are always applied to the user-specific, application-specific domain. The only exception is when an application disable user configuration altogether, in which case the changes are applied to the user-neutral, application-specific configuration.
3.2.1 System Configuration 3.2.2 Graphics Configuration 3.2.3 Engine Configuration 3.2.4 Sound Configuration 3.2.5 Console Configuration 3.2.6 Mouse Configuration
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |