Appearance
ExtractFileDrive
This function returns the drive portion of a file path which includes a filename.
A blank string is returned if no drive or directory is present in the input parameter. The backslashes (\) are not returned.
Declaration: Function ExtractFileDrive(const FileName : string) : string
Example
pascal
procedure OnMapEvent(var Value:Variant);
begin
Value := ExtractFileDrive(Source.FileCon.CurrentFilename);
end;pascal
procedure ScriptEvent (var Value : variant);
var
f: string;
begin
f := 'abc.exe'; LogInfo('ExtractFileExt(''' + f + ''') -> ''' + ExtractFileDrive(f) + '''');
f := 'C:\MyData\MyFiles\abc.exe'; LogInfo('ExtractFileExt(''' + f + ''') -> ''' + ExtractFileDrive(f) + '''');
f := '\MyDrive\MyData\MyFiles\abc.ref1.ref2.txt'; LogInfo('ExtractFileExt(''' + f + ''') -> ''' + ExtractFileDrive(f) + '''');
f := 'D:\MyData\MyFiles\TheDocumentAbc.TXT'; LogInfo('ExtractFileExt(''' + f + ''') -> ''' + ExtractFileDrive(f) + '''');
LogInfo('');
end;The resulting log entries are as follows, where the drive letter and colon (:)only are returned.


