Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-05

Stupid ExcludeTrailingPathdelimiter question

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bart

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.

Bart

Reply by email

Mattias Gaertner
to Bart: I did not expect this: ExcludeTrailingPathDelimiter(/) = {Linux}…
Show quoted text 20 lines
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

Reply by email