[fpc-pascal] Stupid ExcludeTrailingPathdelimiter question
Mattias Gaertner
nc-gaertnma at netcologne.de
Sun May 12 20:04:42 CEST 2013
On Sun, 12 May 2013 11:33:38 +0200
Bart <bartjunk64 at gmail.com> wrote:
> Hi,
>
> I did not expect this:
>
> ExcludeTrailingPathDelimiter(/) = {Linux}
> ExcludeTrailingPathDelimiter(\) = {Windows/WinCE}
> ExcludeTrailingPathDelimiter(c:\) = c:
>
> Reasom I'm asking: Lazarus ShellTreeView crashes if you set Root :=
> '/' (on Linux, and presumably on WinCe as well with Root := '\').
>
> When trying to check if AValue exists it calls
> DirectoryExistsUtf8(ExcludeTrailingPathDelimiter(ExpandFilename(AValue)))
> This allows sloppy programmers, or sloppy users to set Root to
> /home/user/ as well as /home/user, but it fails in th eabove mentioned
> cases.
>
> My Delphi is very old and does not have the
> ExcludeTrailingPathDelimiter function, so I cannot test how Delphi
> behaves.
Use ChompPathDelim instead.
Mattias
More information about the fpc-pascal
mailing list