System.SysUtils.ExtractFileDrive
Delphi
function ExtractFileDrive(const FileName: string): string;
C++
extern DELPHI_PACKAGE System::UnicodeString __fastcall ExtractFileDrive(const System::UnicodeString FileName)/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.SysUtils.pas System.SysUtils.hpp |
System.SysUtils | System.SysUtils |
Description
Returns the drive portion of a file name.
ExtractFileDrive returns a string containing the drive portion of a fully qualified path name for the file passed in the FileName
parameter.
For file names with drive letters, the result is in the form '<drive>'.
For file names with a UNC path (Universal Naming Convention), the result is in the form '\\<servername>\<sharedname>'.
If the given path contains neither style of path prefix, the result is an empty string.
Note: On Linux and MacOS, ExtractFileDrive always returns a zero-length string.