[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'FileUtil' (#lazutils)

ProgramDirectory

Gets the directory where the current program is located.

Declaration

Source position: fileutil.pas line 59

function ProgramDirectory: string;

Function result

Path to the directory where the current program is located.

Description

ProgramDirectory is a String function which gets the path to the directory where the current program is located.

ProgramDirectory calls ParamStrUTF8 to get the command line and arguments used to start the current process. If the initial argument (the executable name) does not include a path to the file, the PATH environment variable was used to locate and start the process. SearchFileInPath is called to search each of the directory paths included in the PATH environment variable.

ProgramDirectory calls GetPhysicalFilename to resolve a symbolic link in the path to the executable. ExpandFileNameUTF8 is called to expand drive letters or relative path references in the return value.

The return value is an empty string if the executable was not located on local file system.

See also

SearchFileInPath

  

Searches for a file name in a given path using the specified base path and options.

ParamStrUTF8

  

Converts the specified command line parameter to a UTF-8-encoded string.

GetEnvironmentVariableUTF8

  

Returns the value of a system environment variable.

GetPhysicalFilename

  

Gets the physical file name for a symbolic link on the local file system.

ExpandFileNameUTF8

  

Expands the values in FileName and BaseDir to an absolute file name.


Version 3.2 Generated 2024-02-25 Home