[Previous][Up][Next] Reference for unit 'sysutils' (#rtl)

Unicode and codepage awareness.

The many functions that deal with filenames in the sysutils routines have been changed from AnsiString to RawByteString so they do not perform implicit codepage conversions to the ANSI code page. At the same time, overloaded versions that accept a Unicode string have been created.

For routines that access actual OS functions using single-byte string APIS, the strings are converted to ensure that the OS routine receives a string with the correct encoding when using single-byte strings. This encoding is normally the DefaultFileSystemCodePage encoding.

On systems with a Unicode I/O API (2-byte strings), the native API is used, meaning that Unicode strings will be passed on as-is, but single-byte strings will be converted (implicitly) to Unicode.

The following is a minimal list of functions that have been changed and duplicated:

Name Description
FileCreate Create a new file and return a handle to it.
FileOpen Open an existing file and return a file handle.
FileExists Check whether a particular file exists in the file system.
DirectoryExists Check whether a directory exists in the file system.
FileSetDate Set the date of a file.
FileGetAttr Return attributes of a file.
FileSetAttr Set the attributes of a file.
DeleteFile Delete a file from the file system.
RenameFile Rename a file.
FileSearch Search for a file in a path.
ExeSearch Search for an executable.
FindFirst Start a file search and return a findhandle.
FindNext Find the next entry in a findhandle.
FindClose Close a find handle.
FileIsReadOnly Check whether a file is read-only.
GetCurrentDir Return the current working directory of the application.
SetCurrentDir Set the current directory of the application.

The following functions do not interact with the OS, but may nevertheless change the codepage of the strings involved in their operation:

Name Description
ChangeFileExt Change the extension of a filename.
ExtractFilePath Extract the path from a filename.
ExtractFileDrive Extract the drive part from a filename.
ExtractFileName Extract the filename part from a full path filename.
ExtractFileExt Return the extension from a filename.
ExtractFileDir Extract the drive and directory part of a filename.
ExtractShortPathName Returns a 8.3 path name.
ExpandFileName Expand a relative filename to an absolute filename.
ExpandFileNameCase Expand a filename entered as case insensitive to the full path as stored on the disk.
ExtractRelativepath Extract a relative path from a filename, given a base directory.
ExpandUNCFileName Expand a relative filename to an absolute UNC filename.
IncludeTrailingPathDelimiter Add trailing directory separator to a pathname, if needed.
IncludeTrailingBackslash Add trailing directory separator to a pathname, if needed.
ExcludeTrailingBackslash Strip trailing directory separator from a pathname, if needed.
ExcludeTrailingPathDelimiter Strip trailing directory separator from a pathname, if needed.
IncludeLeadingPathDelimiter Prepend a path delimiter if there is not already one.
ExcludeLeadingPathDelimiter Strip the leading path delimiter of a path.
IsPathDelimiter Is the character at the given position a pathdelimiter ?
DoDirSeparators Convert known directory separators to the current directory separator.
SetDirSeparators Set the directory separators to the known directory separators.
GetDirs Return a list of directory names from a path.
ConcatPaths Concatenate an array of paths to form a single path.
GetEnvironmentVariable Return the value of an environment variable.

Documentation generated on: Oct 27 2024