Sign in Join
FPDoc Onlineexperiment

GetAppConfigDirUTF8 function

In unit LazFileUtils

Gets the directory for application configuration and data files.

Declaration

pascal
function GetAppConfigDirUTF8(Global: Boolean; Create: Boolean=False)
: string

Description

GetAppConfigDirUTF8 is a String function used to get the directory on the local file system where application configuration and data files are stored.

Global is a Boolean argument that determines if the directory is user- or system- specific. When Global contains False, the home directory for the user is used as the path in the return value.

Create is a Boolean argument that indicates if the configuration directory should be created if not already present on the local file system.

The implementation of GetAppConfigDirUTF8 is platform- and/or OS-specific.

For the Amiga platform, the GetAppConfigDir in the SysUtils unit is called to get the return value.

For Windows environments, the SHGetFolderPathUTF8 function is called to get the path information. The CSIDL (Constant Special Item ID List) required for the setting in Global and the target platform is passed to the routine. When VendorName is provided, it is appended to the path information. ApplicationName is also appended to the path information. If the path cannot be determined, the value from DGetAppConfigDir is used as the directory path.

For UNIX-like environments, the GetAppConfigDir function in the SysUtils unit is called to get the path information.

If the directory does not exist and Create contains True, the ForceDirectoriesUTF8 routine is called to create any missing directories for the path. An EInOutError exception is raised if any missing directory in the path cannot be created.

GetAppConfigDirUTF8 is used in the implementation of the Lazarus IDE and help viewer (LHelp).

See also

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.