[fpc-pascal] Possible RTFM question: is there something like anIsRootPath() function?
Ludo Brands
ludo.brands at free.fr
Mon Aug 20 14:10:10 CEST 2012
> I ended up with this:
>
> function IsRootPath(APath: String): Boolean;
> //crude function, it maybe needs support for UNC drives
> var
> D: String;
> Len: Integer;
> begin
> D := ExtractFileDrive(APath);
> Len := Length(D);
> System.Delete(APath, 1, Len);
> Result := (Length(APath) = 1) and (APath[1] in
> AllowDirectorySeparators);
> end;
>
That doesn't work for // and c:\.\ and many more combinations that all end
up at the root. It doesn't work for relative paths either.
Ludo
More information about the fpc-pascal
mailing list