[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'sysutils' (#rtl)

GetAppConfigFile

Return an appropriate name for an application configuration file.

Declaration

Source position: osutilsh.inc line 42

function GetAppConfigFile(

  Global: Boolean

):string;

function GetAppConfigFile(

  Global: Boolean;

  SubDir: Boolean

):string;

Description

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.

Errors

None.

See also

GetAppConfigDir

  

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

OnGetApplicationName

  

Callback to get a customized application name.

ApplicationName

  

Return a default application name

CreateDir

  

Create a new directory

ConfigExtension

  

Default application configuration file extension.

SysConfigDir

  

System configuration directory.

VendorName

  

Return Application vendor Name


Documentation generated on: Mar 17 2017