[fpc-pascal] DoDirSeparators and special filenames on Windows

Jürgen Hestermann juergen.hestermann at gmx.de
Sat Sep 7 19:14:37 CEST 2013


Am 2013-09-07 18:49, schrieb Bart:
 > That would be wrong.
 > Prepending wiht '\\?\ means that everything should be taken literally,
 > so trying to open/read etc. through WinApi will fail if filename
 > contains double pathedlims,

Of course! Why the hell should there be double pathdelims? And why (silently) accept them as if they were one?


 > dots,

as written: Relative paths should be expanded. Otherwise you can never use them for paths longer than 255 characters.


'/' etc, because these are illegal
 > characters in a filename on Windows.

Illegal characters should be taken just like that: Illegal characters. Why should they be accepted/converted? Who adds illegal characters and expects them to be silently converted to something legal? Just the opposite. I have a directory which ends on a space (don't know how it was created). Although this is "illegal", many programs including explorer could handle this because the underlying file system NTFS allows it. But when you now silently change such illegal situations then the file/path cannot be found anymore.


 > You would also not be able to open files with a relative path:

See above.


 > (And in a threaded program you may not want to call ExpandFilename(),
 > since on Windows this is not threadsafe).

Then you only have the choice between relative paths working for long paths or threadsafe programs.




More information about the fpc-pascal mailing list