Unit 'sysutils' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#rtl]


Return an appropriate name for an application configuration file.


Source position: osutilsh.inc line 45

function GetAppConfigFile(

  Global: Boolean


function GetAppConfigFile(

  Global: Boolean;

  SubDir: Boolean



GetAppConfigFile returns the name of a file in which the application can store its configuration parameters. The exact name and location of the file depends on the customs of the operating system.

The Global parameter determines whether it is a global configuration file (value True) or a personal configuration file (value False).

The parameter SubDir, in case it is set to True, will insert the name of a directory before the filename. This can be used in case the application needs to store other data than configuration data in an application-specific directory. Default behaviour is to set this to False.

Note that on Windows, even when Subdir is False, a subdirectory is created for the application configuration files, as per the windows specifications. Specifying true will create a subdirectory of the application settings subdirectory.

The default file extension of the returned file is: .cfg

No assumptions should be made about the existence or writeability of this file, or the directory where the file should reside. It is best to call ForceDirectories prior to opening a file with the resulting filename.

On systems where the operating system provides a call to determine the location of configuration files, this call will be used. On systems where there is no such call, an algorithm is used which reflects common practice on that system.

The application name is deduced from the binary name via the ApplicationName call, but can be configured by means of the OnGetApplicationName callback.

If VendorName is not-empty, then VendorName will be inserted in the path for the config file directory.



See also



Return the appropriate directory for the application's configuration files.



Callback to get a customized application name.



Return a default application name.



Create a new directory.



Default application configuration file extension.



System configuration directory.



Return Application vendor Name.

Documentation generated on: Jul 24 2023