ProgramDirectory function
Gets the directory where the current program is located.
Declaration
function ProgramDirectory: stringDescription
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
An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.
