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

ExtractFileRoot

Gets the root drive/path/directory for the specified file name.

Declaration

Source position: lazfileutils.pas line 163

function ExtractFileRoot(

  FileName: string

):string;

Arguments

FileName

  

File name examined in the routine.

Function result

Root directory on the file system for the specified file name.

Description

ExtractFileRoot is a String function used to get the root directory for the specified file name. It is file system-aware and includes the drive and/or volume information needed for the file name specified in the FileName argument.

When FileName uses Universal Naming Convention (UNC), the return value will contain any server and share/volume information included in the parameter. For example:

\\server-name\share-name\
\\?\C:\

For UNIX-like environments (as well as WinCE), an initial path delimiter marks the root directory in the file system.

For the Amiga platform, any characters in FileName up to (but not including) the first ":" character are used as the root directory.

For the Windows platform, a drive designation up to and including the first path delimiter are used as the root directory. For example:

C:\

Version 3.2 Generated 2024-02-25 Home