[fpc-pascal] Re: DoDirSeparators and special filenames on Windows

Lukasz Sokol el.es.cr at gmail.com
Wed Sep 11 12:54:32 CEST 2013


On 10/09/13 16:35, Jürgen Hestermann wrote:
> Am 2013-09-09 22: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.
> It could also be that someone wanted to type a letter between both delimiters so dropping
> one of them is trying to guess what the user wanted which leads to errors in most cases.
> Suddenly a file or directory is accessed that was not meant by the user.
> A path should be correct and no more or less smart second guessing should be done.

Only plausible 'smart guess' here is that '\/' or '/\' or '\\' in the path be converted to '\' simply, 
for the '\\?\'mode (on windows of course, Linux doesn't care about '//'s in path)

> Otherwise you can also start a "nearest match" search that tries to find another directory
> in case the specified one is not found. That's something I would expect in C but not in Pascal.
> And even if the WinAPI allows such flaws I don't think that Pascal programmers like this too.

Nearest match search takes cpu, time and resources... 
GetLastOSError (and its format message companion) would tell us that path doesn't exist, will it not?

L.





More information about the fpc-pascal mailing list