[fpc-pascal] DoDirSeparators and special filenames on Windows

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Sep 11 10:04:03 CEST 2013


On Tue, 10 Sep 2013 20:30:16 -0400
<wkitty42 at windstream.net> wrote:

> On Tuesday, September 10, 2013 11:35 AM, Jürgen Hestermann <juergen.hestermann at gmx.de> wrote: 
> > Am 12013090922:28, schrieb Tomas Hajny: 
> >  > ...and the issue is that at least some Windows API functions happily accept 
> > such paths, 
> >  > i.e. programs using such API functions accept them too. 
> >  > If FPC RTL manages to "translate" a path accepted by Windows 
> >  > (and other programs not compiled to FPC too) to something which is not 
> > accepted by 
> >  > Windows (API) any longer, then we may consider fixing such "translation". 
> >  
> > IMO, when a path contains two consecutive path delimiters then something is 
> > wrong. 
> 
> sadly, i've seen this multiple delimiters thing a lot in recent years... it seems that in many cases, they are simply read as one delimiter...
> 
> i've seen this in a lot of web URLs when hiliting and/or clicking on URLs as well as in numerous applications on both *nix and winwhatever... some of this has even been seen in ported applications to OS2...

Many webservers are running on Linux, where double path delims are
pretty normal. You see them pretty often. A common cause are lines like
this:

File=$Directory/filename.ext

You don't need to check if $Directory has already a '/' at the end,
you simply concatenate. Reason is that Linux does not allow empty file
names, so a '//' is never ambiguous and can safely be treated as a
single '/'.

Mattias



More information about the fpc-pascal mailing list