Files Delphi

Title: How to ensure that a path name ends with a delimiter \
{ IncludeTrailingBackslash }
// Adds '\' to the end of a string if it is not already there.
function CheckPfadEnd(const P: string): string;
begin
Result := IncludeTrailingBackslash(P);
end;
ExcludeTrailingBackslash
// Removes one ??\?? from the end of a string if it is there.
MyDir := ExcludeTrailingBackslash(??c:\Windows\??);
// ?? MyDir = c:\Windows