Converter: Improve IsRootPath function. Issue #22630, patch from Bart Broersma

git-svn-id: trunk@38290 -
This commit is contained in:
juha 2012-08-20 21:59:21 +00:00
parent 8297ee1f08
commit d50b5d1cd8

View File

@ -401,13 +401,14 @@ procedure TCacheUnitsThread.Execute;
function IsRootPath(APath: String): Boolean; function IsRootPath(APath: String): Boolean;
//crude function, it maybe needs support for UNC drives //crude function, it maybe needs support for UNC drives
var
D: String;
Len: Integer;
begin begin
{$ifdef windows} D := ExtractFileDrive(APath);
Result := ((Length(APath) = 3) and (APath[1] in ['a'..'z','A'..'Z']) and (APath[2] = ':') and (APath[3] = PathDelim)) Len := Length(D);
or (APath = PathDelim); System.Delete(APath, 1, Len);
{$else} Result := (Length(APath) = 1) and (APath[1] in AllowDirectorySeparators);
Result := (APath = PathDelim);
{$endif}
end; end;
begin begin