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:

  1. 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. You should not modify this default configuration file.
  2. 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.
  3. 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.

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:

  1. Program-specific configuration file (if fglrun.defaults is defined in one of the other levels).
  2. Configuration files defined by the FGLPROFILE environment variable, or appdir/fglprofile, for mobile applications.
  3. 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.