[fpc-pascal] DoDirSeparators and special filenames on Windows
Jürgen Hestermann
juergen.hestermann at gmx.de
Sun Sep 8 15:18:11 CEST 2013
Am 2013-09-08 14:17, schrieb Bart:
> And that is exactly the point.
> GetDir calls GetCurentDirectory and MS says (see:
> http://msdn.microsoft.com/en-us/library/windows/desktop/aa364934%28v=vs.85%29.aspx)
> that multithreaded applications should not call GetCurrentDirectory.
It also says there that multithreaded applications should not use relative paths.
It seems that WinAPI functions which allow relative paths suffer from the same problem:
They have to call GetCurrentDirectory too and are therefore not thread-safe either.
That means that you can use relative paths only for single-threaded programs.
Then it would not matter whether GetCurrentDirectory is called from FPC (while expanding) or through the WinAPI.
So I see no harm in predending '\\?\' and expand relative paths if needed.
Programmers who do not think/know about the special handling of long paths
under Windows (maybe because they started with Linux) would still get a program
that works with long paths too.
I think this is expecially important because of the multi platform approach which IMO
means that the programmer should *not* need to think about OS specialities (as far as possible).
There are enough of them left which the programmer has to take care about,
no need to add those who are avoidable.
More information about the fpc-pascal
mailing list