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

GetTempFileNameUTF8

Gets a temporary file name using the specified UTF-8-encoded path and prefix.

Declaration

Source position: lazfileutils.pas line 158

function GetTempFileNameUTF8(

  const Dir: string;

  const Prefix: string

):string;

Arguments

Dir

  

Directory path for the temporary file name.

Prefix

  

Prefix for the temporary file name.

Function result

Temporary file name generated in the routine.

Description

GetTempFileNameUTF8 is a String function used to get a temporary file name with the specified prefix located in the specified directory.

Dir contains the path on the local file system where the temporary file should be located.

Prefix contains the prefix for the temporary file name. In other words, the temporary file name must start with this sequence of characters.

GetTempFileNameUTF8 signals the OnGetTempFile event handler (when assigned) to get the value used as the temporary file name. When OnGetTempFile has not been assigned, a string is constructed using the path information in Dir and a numeric suffix to make the file name unique. For example:

/usr/tmp/TMP0.tmp

GetTempFileNameUTF8 examines the files in the specified directory to determine if a file already exists which starts with the value in Prefix. If a file is located in the directory, a numeric suffix (starting at 0) is appended to the base file name in Prefix to build a temporary file name which does not already exist in the directory.


Version 3.2 Generated 2024-02-25 Home