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;
//crude function, it maybe needs support for UNC drives
var
D: String;
Len: Integer;
begin
{$ifdef windows}
Result := ((Length(APath) = 3) and (APath[1] in ['a'..'z','A'..'Z']) and (APath[2] = ':') and (APath[3] = PathDelim))
or (APath = PathDelim);
{$else}
Result := (APath = PathDelim);
{$endif}
D := ExtractFileDrive(APath);
Len := Length(D);
System.Delete(APath, 1, Len);
Result := (Length(APath) = 1) and (APath[1] in AllowDirectorySeparators);
end;
begin