Understanding FGLPROFILE
The runtime system uses one or more configuration files in which you can define options and parameters to change the behavior of the programs.
Loading FGLPROFILE files
There are three different levels to specify a configuration file, and these files are loaded in the following order:
- First, the runtime system reads the default configuration file provided in FGLDIR/etc/fglprofile. This file contains all supported entries, identifies the possible values for an entry, and documents default values. it is recommended that you not modify this default configuration file.
- Then, if the FGLPROFILE environment variable is set, the runtime system reads entries from the
files specified by this environment variable. A list of files can be provided with FGLPROFILE. Files
must be separated by the operating system specific path separator. Note: On mobile devices, it is not possible to define environment variables. To specify a custom FGLPROFILE file for a mobile application, you must deploy a file with the name "
fglprofile
" in the appdir directory, along with the other application program files (.42m, .42f, and so on). Only one custom FGLPROFILE file can be deployed for a given mobile application. - After loading and merging the two previous levels, the runtime system checks whether the
fglrun.defaults
entry is set. This entry defines the program-specific profile directory. If this directory contains a file with the same name as the current program (without a .42r extension), the runtime system reads the entries from that file.Note: If the value offglrun.defaults
starts with$envvar
, the specified environment variable is expanded to its value in order to build the path. For example, if the value is"$MYVAR/standard"
, and MYVAR contains /opt/app/config, and the program name is custinfo.42m (or custinfo.42r), the runtime system will try to read the file /opt/app/config/standard/custinfo.
The runtime system merges the different configuration files found at the three levels. If the same entry is defined in several files, the last loaded entry wins. This means that the order of precedence is:
- Program-specific configuration file (if
fglrun.defaults
is defined in one of the other levels). - Configuration files defined by the FGLPROFILE environment variable, or appdir/fglprofile, for mobile applications.
- The default configuration file FGLDIR/etc/fglprofile.
The default FGLPROFILE file
It is recommended that you NOT change the default configuration file in FGLDIR/etc/fglprofile. This file will be overwritten by a new installation and your changes will be lost. It is recommended that you make a copy and define your private configuration file using the FGLPROFILE environment variable.
FGLPROFILE file name
For non-mobile apps, there is no specific naming convention for FGLPROFILE configuration files. You can use a file name without an extension, or the .txt extension for simple text file.
On mobile devices, the name of the custom FGLPROFILE file must be
"fglprofile
", and must be deployed under the appdir
directory.
FGLPROFILE file encoding
The character encoding of FGLPROFILE files must match the application locale.
Defining your own FGLPROFILE entries
User-defined entries can be read with the FGL_GETRESOURCE()
built-in
function.