From 0c7f054e03843213ad62ae818ed1136692927972 Mon Sep 17 00:00:00 2001 From: mattias Date: Thu, 31 Jan 2019 19:16:59 +0000 Subject: [PATCH] docs: lazfileutils, issue #34984, from Don Siders git-svn-id: trunk@60258 - --- docs/xml/lazutils/lazfileutils.xml | 2759 +++++++++++++++++----------- 1 file changed, 1651 insertions(+), 1108 deletions(-) diff --git a/docs/xml/lazutils/lazfileutils.xml b/docs/xml/lazutils/lazfileutils.xml index 6ab0b096be..de82a8320d 100644 --- a/docs/xml/lazutils/lazfileutils.xml +++ b/docs/xml/lazutils/lazfileutils.xml @@ -1,1113 +1,1656 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ForceDirectory - creates a directory if none exists - - - - - - - - - - -Returns True if directory exists or if it was successfully created - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -TrimFilename - trim double path delimiters, heading and trailing spaces and special dirs . and .. -The function cuts leading and trailing spaces and uses ResolveDots to shorten the file name. - - - -ResolveDots - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Creates a relative path from BaseDirectory to Filename -Creates a relative path from BaseDirectory to Filename. -A trailing path delimiter of BaseDirectory is ignored. -If there is no relative path it returns Filename. -If BaseDirectory and Filename are the same and UsePointDirectory is false it returns the empty string. If UsePointDirectory is true it returns '.'. -Duplicate path delimiters are treated as one. -In other words if it returns a relative file name then the following is true: -TrimFilename(Filename) = TrimFilename(BaseDirectory+PathDelim+Result). - -This function is thread safe and therefore does not support current directories -as needed by Windows file names like D:test. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Returns true if Filename is below Path -Path is a directory, Filename a file or directory. Returns true if Filename is a file or directory somewhere below Path. This is a logical test, so it does not check symlinks. Note: if both Filename and Path are the same, the result is false. - -For example under Unix the Filename '/usr/lib/fpc' is below Path '/usr/lib', '/usr' and '/'. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Splits parameters separated by one or more spaces.Parameters are separated by one or more spaces (#9,#10,#13,#32). -Quotes are parsed as single parameter. -if ReadBackslash=true then \" is replaced to " and not treated as quote. -#0 is always end. - + + + + + + + Contains procedures and functions used for file and directory operations + + +

+ LazFileUtils contains procedures and functions used for file and directory operations. This file is part of the LazUtils package. +

+ + All functions are thread safe unless explicitly stated. + +
+ + + + + Gets the relative sort order for the specified file names + + +

+ CompareFilenames is an overloaded Integer function used to compare the specified file names to get their relative order in sorting operations. CompareFilenames provides implementations which accept String or PChar values (and their lengths) as arguments. The implementations are platform- and/or OS-specific; they consider whether the file system is case sensitive or when UTF-8 encoding is supported. +

+

+ The return value indicates the relative order in a sort operation, and can contain the following values: +

+
+
<0
+
Filename1 comes before Filename2
+
0
+
Filename1 and Filename2 to have the same value
+
>0
+
Filename1 comes after Filename2
+
+
+ + + +
-Resolves a symlink to the real file. It does not resolve symlinks in parent directories.If a symlink can not be resolved the function returns the empty string if ExceptionOnError is false. If ExceptionOnError is true it raises an EFOpenError with a message, containing more details. -On Windows it simply returns Filename. - Resolves all symlinks in Filename, including all directories.If a symlink can not be resolved the function returns the empty string if ExceptionOnError is false. If ExceptionOnError is true it raises an EFOpenError with a message, containing more details. - - Resolves a symlink to the real file. It does not resolve symlinks in parent directories.If a symlink can not be resolved it returns Filename. -It uses ReadAllLinks. - - Removes duplicate path delimiters and resolves logically . and ..This function shortens duplicate path delimiters to single path delimiters. -It resolves 'A/../B' to 'B', which might be wrong under Unix if A is a symlink. The functions does not check the file system. -The single dot './A' is resolved to 'A', but a single '.' is kept as '.'. - - - Works as the WinAPI function SHGetFolderPathW, except it returns an UTF8 encoded string. - -
-
+ + + Relative sort order for the specified file names + + + + + First file name for the comparison + + + + + Second file name for the comparison + + + + + + Gets the relative sort order for case-insensitive file names + + +

+ CompareFilenamesIgnoreCase is an overloaded Integer function used to compare the specified file names to get their relative order in case-insensitive sorting operations. CompareFilenamesIgnoreCase provides alternate implementations which accept String or PChar values (and their lengths) as arguments. The implementations are platform- and/or OS-specific; they consider whether the file system is case sensitive or when UTF-8 encoding is supported. +

+

+ The return value indicates the relative order in a case-insensitive sort operation, and can contain the following values: +

+
+
<0
+
Filename1 comes before Filename2
+
0
+
Filename1 and Filename2 to have the same value
+
>0
+
Filename1 comes after Filename2
+
+
+ + + + +
+ + + + Relative sort order for the file names + + + + + First file name for the comparison + + + + + Second file name for the comparison + + + + + + Performs a sort order comparision for the specified file name and extension + + +

+ CompareFileExt is an Integer function used to compare the file extension in FIlename to the value in Ext. Ext may contain the '.' character, but it is not required and will be removed for the comparison. CaseSensitive indicates whether case is ignored in the comparision. When CaseSensitive contains True, CompareStr is called to perform the comparison. Otherwise, UTF8CompareText is called to compare the values. The return value will contain one of the following: +

+
+
-1
+
+ Filename value has a lower sort order value than Ext +
+
0
+
+ Filename and Ext have the same sort order values +
+
1
+
+ Filename value has a higher sort order value than Ext +
+
+

+ The return is 1 if Filename does not contain a file extension. +

+
+ + +
+ + + + Relative sort order for the compared values + + + + + File name for the comparision + + + + + File extension for the comparison + + + + + True if case sensitive comparison is needed + + + + + + Compares file names using the number characters in common + + +

+ CompareFilenameStarts is an Integer function used to compare the specified file names to determine their relative sort order. Arguments in Filename1 and Filename2 do not need to be the same length. When they have different lengths, the number of characters common to both are used in the comparison. CompareFilenameStarts calls CompareFileNames to perform the comparison, and get the return value for the function. +

+

+ See CompareFilename for more information about the numeric return value and its meaning. +

+
+ + CompareFIlenames + CompareFIlename + +
+ + + + Relative sort order for the compared values + + + + + First file name for the comparison + + + + + Second file name for the comparison + + + + + Length of the first file name + + + + + Length of the seconds file name + + + + + + Indicates if the specified directory name exists in the file system + + +

+ DirPathExists is a Boolean function which indicates if the specified directory name exists in the file system. DirectoryName can contain a trailing path delimiter, but it removed in the function. DirPathExists calls DirectoryExistsUTF8 to get the return value. +

+
+ + + +
+ + + + True when the specified directory exists in the file system + + + + + DIrectory Name to locate + + + + + + Indicates if the specified directory name is writable + + +

+ DirectoryIsWritable is a Boolean function used to determine if the specified directory name is writable in the file system. The path name in DirectoryName must already exist on the local file system. The return value is False if a directory with the specified name does not exist. +

+

+ The return value is True when a file can be added, deleted, or modified in the specified path. To get the return value, DirectoryIsWritable creates a temporary file in DirectoryName, adds content to it, and deletes the temporary file. DirectoryIsWritable calls the FileCreateUTF8, FileWrite, FileClose, and DeleteFileUTF8 routines to perform the file operations. The return value is True when FileWrite completes successfully. +

+ + Please note: DirectoryIsWritable calls InvalidateFileStateCache with the temporary file name if DeleteFileUTF8 cannot remove the file. + +
+ + + + + + + + + +
+ + + + True if the specified directory is writable + + + + + Directory name to examine in the function + + + + + + Gets the base file name (without the file extension) in the specified path + + +

+ ExtractFileNameOnly is a String function used to extra the base file name (without the file extension) from the value in AFilename. Path information, up to the last directory separator ('/' or '\') or device separator (':') character, in AFileName is ignored. The file extension, starting at the '.' character, is also omitted. +

+
+ +
+ + + + Base file name in the file path + + + + + File path and name to examine in the function + + + + + + Determines if the specified value is an absolute file path (not a relative one) + + +

+ FilenameIsAbsolute is a Boolean function used to determine if the value in TheFilename contains an absolute file path (and not a relative one). The implementation for FilenameIsAbsolute is platform- and/or OS-specific. +

+

+ In UNIX-like environments, the FilenameIsUnixAbsolute function is used in the implementation. The return value is False if TheFilename is an empty string (''), or does not start with the directory separator for the environment. +

+

+ On Windows, the FilenameIsWinAbsolute function is called in the implementation. FilenameIsWinAbsolute takes Device identifiers into consideration when examining the value in TheFilename. For example: +

+ + D:\db\employee.fdb + +

+ The return value is False if TheFilename (without the optional device identifier) is an empty string (''), or does not start with the directory separator for the environment. +

+
+ +
+ + + + True when the file name is not a relative path + + + + + Path and file name to use in the function + + + + + + Determines if the specified value is an absolute file path (not a relative one) + + +

+ FilenameIsWinAbsolute is a Boolean function used to determine if the value in TheFilename contains an absolute file path (and not a relative one). +

+

+ On Windows, the FilenameIsWinAbsolute function is called in the implementation of FilenameIsAbsolute. FilenameIsWinAbsolute takes Device identifiers into consideration when examine the value in TheFilename. For example: +

+ + D:\db\employee.fdb + +

+ The return value is False if TheFilename (without the optional device identifier)is an empty string (''), or does not start with the directory separator for the environment. +

+
+ +
+ + + + True when the file name is not a relative path + + + + + Path and file name to use in the function + + + + + + Determines if the specified value is an absolute file path (not a relative one) + + +

+ FilenameIsUnixAbsolute is a Boolean function used to determine if the value in TheFilename contains an absolute file path (and not a relative one). +

+

+ In UNIX-like environments, the FilenameIsUnixAbsolute function is used in the implementation of FilenameIsAbsolute. The return value is False if TheFilename is an empty string (''), or does not start with the directory separator for the environment. +

+
+ +
+ + + + True when the file name is not a relative path + + + + + Path and file name to use in the function + + + + + + Creates the specified directory if it does not already exist + + +

+ ForceDirectory is a Boolean function which creates the specified directory if it does not already exist. ForceDirectory ensures that a trailing path delimiter exists in DirectoryName prior to checking the file system. Each directory in the specified path is examined in the function using DirPathExists. ForceDirectory calls CreateDirUTF8 if a directory does not exist, and may exit with a return value of False if directory creation is not successful. +

+

+ The return value is True if all directories in the path information already exist, or are successfully created in the function. +

+
+ + + +
+ + + + Returns True if directory exists or if it was successfully created + + + + + Path information for the operation + + + + + + Examines the specified file to see if it is executable + + +

+ CheckIfFileIsExecutable is a procedure used to examine the specified file name to see if it is executable. CheckIfFileIsExecutable is implemented for UNIX-like environments, and allows TProcess to better determine if the file can be executed on the platform or OS, and to get better error messages when it cannot. +

+

+ CheckIfFileIsExecutable raises an exception with a specific mesage when the platform or OS facilities indicate it is necessary. +

+

+ Use FileIsExecutable to determine of a file is executable without raising an exception. +

+
+ +

+ The Exception contains the following messages (from string resources): +

+
+
lrsFileDoesNotExist
+
+ Raised when FileExistsUTF8 returns False +
+
lrsFileIsADirectoryAndNotAnExecutable
+
+ Raised when DirPathExists indicates the file is actually a directory name +
+
lrsReadAccessDeniedFor
+
+ Raised when fpGetErrno() returns ESysEAcces +
+
lrsADirectoryComponentInDoesNotExistOrIsADanglingSyml
+
+ Raised when fpGetErrno() returns ESysENoEnt +
+
lrsADirectoryComponentInIsNotADirectory
+
+ Raised when fpGetErrno() returns ESysENotDir +
+
lrsInsufficientMemory
+
+ Raised when fpGetErrno() returns ESysENoMem +
+
lrsHasACircularSymbolicLink
+
+ Raised when fpGetErrno() returns ESysELoop +
+ +
lrsIsNotExecutable
+
+ Raised when fpGetErrno() has a value other than the above +
+
+
+ + + +
+ + + + File name to examine + + + + + + Determine if the specified file name is executable + + +

+ FileIsExecutable is a Boolean function used to determine if the specified file name is executable. For UNIX-like environments, a combination of FpStat, FPS_ISREG, and FpAccess are used to get the return value. For the Windows enviroment, the value fromFileExistsUTF8 is used as the return value. In short, the function is not really useful in a Windows environment. +

+
+ +
+ + + + True if the file is executable on the platform or OS + + + + + File name to examine + + + + + + Indicates if the specified file name is readable + + +

+ FileIsReadable is a Boolean function which indicates if the specified file name is readable. For UNIX-like environments, FpAccess is used to get the return value. On Windows, the return value is the result from FileExistsUTF8. In short, the function is not really useful on the Windows platform. +

+
+ +
+ + + + True when the specified file name is readable + + + + + File name to examine + + + + + + Indicates if the specified file name is writable + + +

+ FileIsWritable is a Boolean function which indicates if the specified file name is writable. For UNIX-like environments, FpAccess is used to get the return value. For Windows, FileGetAttrUTF8 is used to determine if faReadOnly is omitted from the attributes for the file. +

+
+ + +
+ + + + True when the specified file name is writable + + + + + File name to examine + + + + + + Determine if the specified file contains plain text content + + +

+ FileIsText is a Boolean function used to determine if the specified file contains plain text content. The overloaded variant that includes the FileReadable argument is used to examine the content in the file. +

+

+ FileIsText calls FileOpenUtf8 for the specified file name. The return value is False is the file handle contains feInvalidHandle. +

+

+ FileIsText checks for (and skips) common Byte Order Marks, such as: +

+
    +
  • UTF-8 BOM (Hex $EF $BB $BF)
  • +
  • UCS-2LE BOM (Hex $FF $FE)
  • +
  • UCS-2BE BOM (Hex $FE $FF)
  • +
+

+ Content in the file (up to 1024 characters) is checked to ensure that invalid Null and Control characters are not found in the file. The return value is True when the specified file name exists in the local file system, and does not contain Null or Control characters. +

+
+ +
+ + + + True when the file contains plain text content + + + + + File name to examine in the function + + + + + Indicates if the specified file was successfully opened and read + + + + + + +

+ FilenameIsTrimmed is an overloaded Boolean function used to determine if the specified file name contains characters ro remove or resolve before use. The variant which uses PChar values performs the comparison. The return value is False when the file name is a candidate for use of TrimFilename to remove whitespace or special characters. +

+

+ Use TrimFilename to remove leading or trailing whitespace, duplicate directory separators, or relative path symbols. +

+
+ +
+ + + + False when the file name needs to trimmed + + + + + File name to examine in the function + + + + + PChar with the file name value + + + + + Length of the file name + + + + + + Removes leading and trailing spaces, and resolves special characters + + + TrimFilename is a String function used to remove leading and trailing spaces (Decimal 32) in the specified path and file name. In addition, ResolveDots is called to expand directory characters (like '.' and '..') and to remove duplicate path delimiters (like '//'). + + + + + + + + + + + + + + + New value for the path and file name + + + + + Path and file name for the operation + + + + + + Removes whitespace and resolve special characters in the specified file name + + +

+ CleanAndExpandFilename is a String function used to remove whitespace and to resolve special characters in the specified file name. CleanAndExpandFilename calls TrimFilename and ExpandFileNameUTF8 to get the return value for the function. The return value is the current directory when Filename contains an empty string (''). +

+
+ +
+ + + + File name with whitespace removed and special charcters resolved + + + + + File name to examine in the function + + + + + + Removes whitespace and resolves special characters in the specified path + + +

+ CleanAndExpandDirectory is a String function used to remove whitespace and resolve special characters in the specified path. CleanAndExpandDirectory calls CleanAndExpandFilename to get the return value for the function. CleanAndExpandDirectory calls AppendPathDelim to ensure that a trailing path delimiter is included in the return value. The return value is the current directory when the specified path contains an empty string (''). +

+
+ +
+ + + + + Path information after removing whitespace and resolving special characters + + + + + + Path information for the function + + + + + + Cleans and resolves a file path to the specified base directory name + + +

+ TrimAndExpandFilename is a String function used to remove whitespace and special characters in Filename, and to resolve the relative file path to the directory in BaseDir. TrimAndExpandFilename removes a trailing path delimiter in FIlename, and calls ExpandFileNameUTF8 and TrimFilename to get the return value for the function. +

+

+ The return value is an empty string ('') if Filename contains an empty string (''). +

+
+ +
+ + + + Cleaned and resolved file path + + + + + File name for the function + + + + + Base directory name used for a relative file path + + + + + + Cleans and resolves a relative path to a base directory + + +

+ TrimAndExpandDirectory is a String function used to remove whitespace and special characters in the path information, and to resolve a relative path to the specified base directory. +

+

+ TrimAndExpandDirectory calls TrimFilename. The return value is an empty string ('') when TrimFilename returns an empty string (''). +

+

+ TrimAndExpandDirectory calls ExpandFileNameUTF8 to resolve the relative path, and calls TrimFilename to get the return value for the function. +

+
+ +
+ + + + Path information cleaned and resolved to the specified base directory + + + + + Path information for the function + + + + + Base directory used to resolve a relative path + + + + + + Creates a relative path from BaseDirectory to Filename + + +

+ CreateRelativePath is a String function used to get the relative path from BaseDirectory to Filename. A trailing path delimiter in BaseDirectory is ignored. If there is no relative path, the value in Filename is returned. +

+

+ When BaseDirectory and Filename contain the same value, and UsePointDirectory is False, an empty string ('') is used as the return value. If UsePointDirectory contains True, the return value is '.'. Duplicate path delimiters are removed. For example, the following is True: +

+ + TrimFilename(Filename) = TrimFilename(BaseDirectory+PathDelim+Result). + + + CreateRelativePath is thread safe and therefore does not guarantee that the current directory is correct for file names like 'D:test.txt'. + +
+ +
+ + + + Relative path from the base directory for the file name + + + + + File name for the operation + + + + + Base directory for the relative path + + + + + + True if '.' (current directory symbol) is prepended to the relative path + + + + + + + Returns True if Filename exists in the specified Path + + +

+ FileIsInPath is a Boolean function which indicates if the file name exists in the specified path. Filename is the file name to locate, and may include optional relative path information. For example: '../filename.txt'. +

+

+ Path is the directory name used to locate the specified file. For example: '/usr/lib/fpc'. +

+

+ The returns value is True when Filename is a file or directory somewhere below Path. For example, under UNIX the Filename '/usr/lib/fpc' is below Path '/usr/lib', '/usr' and '/'. When Filename and Path contain the same value, the return value is False. Please note: the return value is False when Path contains an empty string (''). +

+

+ FileIsInPath calls ResolveDots to resolve relative path information in both Filename and Path, and ensures that a trailing path delimiter is included in Path when needed. FileIsInPath calls CompareFileNames. +

+ + This is a logical test; FileIsInPath does not expand or follow symbolic links. + +
+ +
+ + + + True when the file exists in the specified path + + + + + File name to locate + + + + + Path used for the operation + + + + + + Adds a trailing path delimiter when needed + + +

+ AppendPathDelim is a String function used to ensure that a trailing path delimiter is included in the specified Path. The return value includes the value in Path and the trailing path delimiter (when needed). +

+
+ +
+ + + + Path value with a trailing path delimiter + + + + + Path value to examine + + + + + + Removes a trailing path delimiter from the specified value + + +

+ ChompPathDelim is a String function used to remove a trailing path delimiter from the specified value in Path. For environments where UNC paths are allowed, ChompPathDelim ensures that the UNC path delimiters are retained. Windows Device identifiers, such as "D:" are also retained in Path. +

+
+ +
+ + + + Path information after removing the trailing path delimiter + + + + + Path information for the function + + + + + + Indicates if the specified file name exists + + +

+ FileExistsUTF8 is a Boolean function which indicates if the specified file name exists in the local file system. For the Windows environment, FileExistsUTF8 uses FileGetAttrUTF8 to ensure that Filename does not have the FILE_ATTRIBUTE_DIRECTORY attribute. For UNIX-like environments, the FileExists function in SysUtils is used to get the return value. +

+
+ +
+ + + + True when the specified file name exists + + + + + File name to locate in the file system + + + + + + Returns the last modification time for the file in FileDate format + + +

+ FileAgeUTF8 is a Longint function which returns the last modification time for the file in FileName. FileAgeUTF8 cannot be used on directories, and returns -1 if FileName indicates a directory. +

+

+ For UNIX-like environments, the return value is provided by the FileAge function in SysUtils. For the Windows environment, FindFirstFileW is used to get TWin32TWin32FindDataW data for the specified file. Its ftLastWriteTime value is converted using WinToDosTime to get the return value for the function. +

+

+ The return value is in FIleDate format, and can be transformed to TDateTime format with the FileDateToDateTime function. +

+
+ +
+ + + + Last modification time for the file in FileDate format + + + + + File name for the function + + + + + + Determine if the specified path exists on the local file system + + +

+ DirectoryExistsUTF8 is Boolean function used to determine if the specified path exists on the local file system. For the Windows environment, FileGetAttrUTF8 is called to see if FILE_ATTRIBUTE_DIRECTORY is include in the file attributes for Directory. For UNIX-like environments, the DirectoryExists function in SysUtils is used to get the return value. +

+
+ +
+ + + + True when the directory exists in the file system + + + + + Directory name to locate in the file system + + + + + + Expands the values in FileName and BaseDir to an absolute file name + + +

+ ExpandFileNameUTF8 is a String function which expands the UTF-8-encoded values in FileName and BaseDir to an absolute file name. It changes all directory separator characters to the one appropriate for the system. +

+

+ If an empty string ('') is passed in Filename, it is expanded to the current directory using GetCurrentDirUTF8. When FileName contains the tilde character ('~'), it is converted to the path to the home directory for the user using the HOME environment variable. Relative paths in FileName are resolved by calling ResolveDots. +

+
+ + +
+ + + + File name with an absolute path + + + + + File name for the operation + + + + + Base directory for the operation + + + + + + Starts searching for files matching the specified path value + + +

+ FindFirstUTF8 searches the file specified in Path. Normal files, as well as all special files which have the attributes specified in Attr will be returned. +

+

+ It returns a SearchRec record for further searching in Rslt. Path can contain the wildcard characters; ? (matches any single character) and * (matches 0 or more arbitrary characters). In this case FindFirstUTF8 will return the first file which matches the specified criteria. +

+

+ If GetLastError is different from zero, no files matching the criteria were found. The return value is the value from GetLastError. +

+
+ + + + +
+ + + + Last error number encountered in the function + + + + + Path and/or file name to locate + + + + + File attributes to include in the search + + + + + Search record for the first matching file + + + + + + Locates another file matching the search criteria + + +

+ FindNextUTF8 is a Longint function used to locate another file matching the TSearchRec value in Rslt. Rslt is populated in a prior call to FindFirstUTF8, and updated in FindNextUTF8. +

+

+ For the Windows environment, FindNextFileW is called to compare the TWIN32FINDDATAW for the matching file. For UNIX-like environments, the FindNext function in SysUtils is used. +

+

+ The return value contains the result from GetLastError; a non-zero value indicates that an error was encountered. +

+
+ +
+ + + + Last error number + + + + + Search criteria for the function + + + + + + Frees resources allocated to the specified search record + + +

+ FindCloseUTF8 is a procedure used to free resources allocated to the search record in F. FindCloseUTF8 is needed to free the internal resources allocated to the search record in FindFirstUTF8. FindCloseUTF8 calls the FindClose function in SysUtils. +

+
+ +
+ + + + Search record to free in the procedure + + + + + + Sets the last modification time for the file + + +

+ FileSetDateUTF8 is a Longint function used to set the last modification time for the file to the specified Age in FileDate format. Use DateTimeToFileDate to convert a TDateTime value to FileDate format. +

+

+ For the Windows enviroment, a handle is created for the specified file name, and SetFileTime is called to store the updated file age. For UNIX-like enviroments, FileSetDate in SysUtils is called to set the file age. InvalidateFileStateCache is also called for the specified file name. +

+

+ The return value is the value from GetLastError; a non-zero value indicates that an error has occurred. +

+
+ +
+ + + + Last error number in the function + + + + + File name to update in the function + + + + + New value for the last modification time + + + + + + Gets the value of file attributes for the specified file name + + +

+ FileGetAttrUTF8 is a Longint function used to get files attributes for the specified file name. For the Windows enviroment, GetFileAttributesW in Windows is called to the file attribute value for Filename. For UNIX-like enviroments, FileGetAttr in SysUtils is called to the the return value. +

+

+ The return value contains a numeric value that can be OR-ed with the following constants to get a specific file attribute: +

+
+
faReadOnly
+
+ The file is read-only +
+
faHidden
+
+ The file is hidden (On UNIX, the filename starts with a dot) +
+
faSysFile
+
+ The file is a system file (On UNIX, the file is a character, block or FIFO file). +
+
faVolumeId
+
+ Volume Label (For DOS/Windows on a plain FAT - not VFAT or Fat32) +
+
faDirectory
+
+ File is a directory +
+
faArchive
+
+ File is ready to be archived (Not possible on UNIX) +
+
+
+ +
+ + + + File attribute value for the specified file name + + + + + File name for the function + + + + + + Sets the file attribute value for the specified file name + + +

+ FileSetAttrUTF8 is a Longint function used to set the file attributes for the specified file name to the value in Attr. The value in Attr can be set by AND-ing pre-defined file attribute constants, such as: +

+
+
faReadOnly
+
+ The file is read-only +
+
faHidden
+
+ The file is hidden (On UNIX, the filename starts with a dot) +
+
faSysFile
+
+ The file is a system file (On UNIX, the file is a character, block or FIFO file). +
+
faVolumeId
+
+ Volume Label (For DOS/Windows on a plain FAT - not VFAT or Fat32) +
+
faDirectory
+
+ File is a directory +
+
faArchive
+
+ File is ready to be archived (Not possible on UNIX) +
+
+

+ For UNIX-like environments, FileSetAttr in SysUtils is called to set the file attributes value. InvalidateFileStateCache is also called for the specified file name. For the Windows environment, SetFileAttributesW in Windows is called to set the attributes value for the specified file name. +

+

+ The return value contains the result from GetLastError; a non-zero value indicates that an error has occurred. +

+
+ +
+ + + + Last error number from the function + + + + + File name to update in the function + + + + + File attribute value for the specified file name + + + + + + Deletes the specified file name + + +

+ DeleteFileUTF8 is a Boolean function used to delete the specified file name. +

+

+ For the Windows environment, DeleteFileW in Windows is called to remove the specified file name. For UNIX-like enviroments, DeleteFile in SysUtils is called to delete the specified file name. InvalidateFileStateCache is also called. +

+

+ The return value contaIns True when Filename is successfully deleted from the local file system. +

+
+ +
+ + + + True if the specified file name is deleted + + + + + File name to delete in the function + + + + + + Renames a file to the specified value + + +

+ RenameFileUTF8 is a Boolean function used to rename a file to the specified new value. +

+

+ For the Windows enviroment, MoveFileW is called to rename the file using the values specified in OldName and NewName. For UNIX-like enviroments, RenameFIle in SysUtils is called to rename the file to the specified new value. InvalidateFileStateCache is also called. +

+

+ The return value is True if the file is renamed successfully. +

+
+ + +
+ + + + True if the file is successfully renamed to the new value + + + + + Existing name for the file + + + + + New name for the file + + + + + + Searches for a file with the specified name in the list of directory paths + + +

+ FileSearchUTF8 is a String function used to search for files with the specified name in the list of directory paths. +

+

+ DirList is a list of file paths to search in the function. Values in DirList are separated by the PathSeparator character for the environment. No additional directories are searched when DirList contains an empty string (''). +

+

+ ImplicitCurrentDir controls whether the search is implicitly limited to the current directory. The default value for ImplicitCurrentDir is True. When a file with the specified Name is located in the current directory, no additional searches are needed. The return value is the name of the file without any path information. +

+

+ When ImplicitCurrentDir is False, each path in DirList is searched for a file with the specified name. The search is stopped when the first file with the specified file name is found. The return value contains the path in DirList where the file name was located along with the file name, or an empty string ('') if the specified file is not found. +

+
+ +
+ + + + Path and file name for the matching file, or an empty string + + + + + File name to locate in the list of directory paths + + + + + The delimited list of directory paths to search + + + + + + Determines if the specified file is marked as read-only + + +

+ FileIsReadOnlyUTF8 is a Boolean function used to determine if the specified file is marked as read-only in the local file system. FileIsReadOnlyUTF8 calls FileGetAttrUTF8 for the specified file name and checks to see if faReadOnly has been included in the file attributes value. The return value is True when faReadOnly has been included. +

+
+ +
+ + + + True when the file is marked as read-only + + + + + File name to examine in the function + + + + + + Gets the name for the current directory + + +

+ GetCurrentDirUTF8 is a String function used to get the name for the current directory in the local file system. +

+ For the Windows environment, GetCurrentDirectoryW is called to get the current directory name. UTF8Encode is called to convert the WideString value to UTF-8, and used as the return value for the function. +

+

+

+ For UNIX-like enviroments, GetCurrentDir in SysUtils is called to get the current directory name. +

+
+ +
+ + + + Name for the current directory + + + + + + Sets the current directory to the specified name + + +

+ SetCurrentDirUTF8 is a Boolean function used to set the current directory in the local file system to the specified value. +

+

+ For the Windows environment, UTFDecode is called to convert NewDir and passed to SetCurrentDirectoryW to set the current directory name. Windows CE raises an exception in SetCurrentDirUtf8; the concept of a current directory does not exist in Windows CE. +

+

+ For UNIX-like enviroments, SetCurrentDir in SysUtils is used to set the current directory to the specified value. +

+

+ The return value is True if the current directory is successfully changed to the new value. +

+
+ +
+
TException
+
+ Raised for the Windows CE environment; exception message is: '[SetCurrentDirWide] The concept of the current directory doesn''t exist in Windows CE' +
+
+
+ +
+ + + + True if the current directory was successfully changed to the new value + + + + + Directory name to use as the current directory + + + + + + Creates a new directory with the specified name + + +

+ CreateDirUTF8 is a Boolean function used to create a new directory in the local file system with the specified name. For the Windows enviroment, the value in NewDir is converted to wide string format and passed to the CreateDirectoryW function in the Windows unit. For UNIX-like enviroments, CreateDir in SysUtils is used to create the new directory with the specified name. +

+

+ The return value is True if the new directory is successfully created. +

+
+ +

+ An error can occur if a directory with the specified name already exists in the local file system. +

+
+ +
+ + + + True if the new directory is successfully created + + + + + Name for the new directory + + + + + + Removes the directory with the specified name + + +

+ RemoveDirUTF8 is a Boolean function used to remove the directory with the specified name from the local file system. +

+

+ For the Windows environment, UTF8Decode is called to convert the value in Dir to wide string format. The RemoveDirectoryW function in the Windows unit is called to remove the specified directory. +

+

+ For UNIX-like environments, RemoveDir in SysUtils is called to remove the specified directory. +

+

+ The return value is True when the specified directory is successfully removed. +

+
+ + + + +
+ + + + True when the directory is successfully removed + + + + + Name of the directory to remove in the function + + + + + + Creates the specified directories if they do not already exist + + +

+ ForceDirectories is a Boolean function which creates the specified directories if they do not already exist. ForceDirectories examines the value in Dir to determine if it contains a Windows device identifier or a UNC name. If a device identifer or UNC name is found, but not supported on the platform, no actions are perfomed in the function. +

+

+ ForceDirectories raises an EInOutError exception with the message in SCannotCreateEmptyDir when Dir contains an empty string (''). +

+

+ Each directory in the specified path is checked using DirectoryExistsUTF8. ForceDirectories calls CreateDirUTF8 if a directory does not exist, and may exit with a return value of False if directory creation is not successful. The return value is True if all directories in the path information already exist, or are successfully created in the function. +

+
+ +
+
EIOnOutError
+
+ Raised when the directory name is an empty string (''); Message is SCannotCreateEmptyDir, and ErrorCode is set to 3. +
+
+
+ + + + +
+ + + + + True when directories exist or are successfully created in the function + + + + + + Path information to examine the function + + + + + + Specifies the event signalled for an invalid file state in the file cache + + +

+ TInvalidateFileStateCacheEvent is a type which specifies the event signalled for an invalid file state in the file cache. TInvalidateFileStateCacheEvent is the type used for the OnInvalidateFileStateCache event handler. +

+
+ +
+ + + + File name for the eventg notification + + + + + + Implements the event handler for a file with an invalid file state + + +

+ OnInvalidateFileStateCache is a TInvalidateFileStateCacheEvent variable which implements the event handler signalled for a file with an invalid file state. OnInvalidateFileStateCache allows an application to respond to the event notification for a specific file. OnInvalidateFileStateCache is signalled when InvalidateFileStateCache is called by routines that perform file manipulation. +

+

+ OnInvalidateFileStateCache is significant for UNIX-like environments only, such as Linux and Amiga. OnInvalidateFileStateCache is not used in Windows environments. +

+
+ +
+ + + + + Signals the OnInvalidateFileStateCache event handler + + +

+ InvalidateFileStateCache is a procedure used to signal the OnInvalidateFileStateCache event handler for the specified file name. InvalidateFileStateCache is used when an invalid file state is detected in routines which perform file manipulation, such as: +

+
    +
  • DeleteFileUTF8
  • +
  • FileSetAttrUTF8
  • +
  • FileSetDateUTF8
  • +
  • RenameFileUTF8
  • +
+

+ InvalidateFileStateCache is significant for UNIX-like environments only, such as Linux and Amiga. InvalidateFileStateCache is not used in Windows environments. +

+
+ +
+ + + + + + + + + Splits command line parameters separated by whitespace characters + + +

+ Parameters are separated by one or more whitespace characters (#9,#10,#13,#32). Quoted values are parsed as a single parameter. If ReadBackslash contains True, then \" is replaced with " and not treated as a quoted value. #0 (Decimal 0) is always treated as the end of the Parameters value. +

+
+
+ + + + Resolves a symbolic link to an actual file name + + +

+ Resolves a symbolic link to an actual file name. It does not resolve symlinks in parent directories. If a symlink can not be resolved and if ExceptionOnError is False, the function returns an empty string (''). If ExceptionOnError is True, it raises an EFOpenError with a message, containing more details. On Windows it simply returns Filename. +

+
+
+ + + + Resolves all symlinks in Filename, including all directories + + +

+ If a symlink can not be resolved, and ExceptionOnError is False, the function returns the empty string (''). If ExceptionOnError is True, it raises an EFOpenError with a message containing more details. +

+
+
+ + + + Resolves a symlink to the real file + + +

+ If a symlink can not be resolved it returns Filename. It uses ReadAllLinks. +

+
+
+ + + + Removes duplicate path delimiters and resolves . and .. + + +

+ This function shortens duplicate path delimiters to single path delimiters. It resolves 'A/../B' to 'B', which might be wrong under Unix if A is a symlink. The functions does not check the file system. The single dot './A' is resolved to 'A', but a single '.' is retained. +

+
+
+ + + + Works like the WinAPI function SHGetFolderPathW, but returns an UTF-8-encoded string + + +
+ + +