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

2013-09-08 Thread Jürgen Hestermann
Am 2013-09-07 21:46, schrieb Bart: > On 9/7/13, Jürgen Hestermann wrote: >> Of course! Why the hell should there be double pathdelims? And why >> (silently) accept them as if they were one? > There should not be, but (history: DOS and) WinApi accept them, so the > are NOT illegal in normal filena

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

2013-09-08 Thread Tomas Hajny
On Sat, September 7, 2013 18:49, Bart wrote: . . > You would also not be able to open files with a relative path: > FileExists('foo\bar.txt') wil then internally be translated to "Ask > the WinApi if '\\?\foo\bar.txt' exists", and this will fail, since the > '\\?\' scheme needs a fully qualified

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

2013-09-08 Thread Bart
On 9/8/13, Tomas Hajny wrote: > Why do you believe that ExpandFilename is not threadsafe (on Windows or > any other platform)? .. > The only platform specific part inside > ExpandFilename is a call to GetDir function retrieving the current > directory. If that is not 'threadsafe' by itself (on Wi

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

2013-09-08 Thread Jürgen Hestermann
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

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

2013-09-08 Thread Tomas Hajny
On Sun, September 8, 2013 14:17, Bart wrote: > On 9/8/13, Tomas Hajny wrote: > >> Why do you believe that ExpandFilename is not threadsafe (on Windows or >> any other platform)? > .. >> The only platform specific part inside >> ExpandFilename is a call to GetDir function retrieving the current >>

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

2013-09-08 Thread Bart
On 9/8/13, Jürgen Hestermann wrote: > 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 > eit

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

2013-09-08 Thread Bart
On 9/8/13, Tomas Hajny wrote: > OK, I'll have a look at the MSDN link once I sit at some machine with a > bigger display than my phone. ;-) > Good, thanks for the pointer. We may indeed want to add some safeguards to > the Windows GetDir implementation (or possibly check some alternative > so

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

2013-09-08 Thread Sven Barth
On 08.09.2013 14:17, Bart wrote: On 9/8/13, Tomas Hajny wrote: Why do you believe that ExpandFilename is not threadsafe (on Windows or any other platform)? .. The only platform specific part inside ExpandFilename is a call to GetDir function retrieving the current directory. If that is not '

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

2013-09-08 Thread Sven Barth
On 08.09.2013 15:29, Tomas Hajny wrote: of ExpandFilename - well, that may be the case, but that is not special for Windows and it should be the responsibility of the programmer either not to change the current directory in other threads, But GetDir just does that: it changes the current direct

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

2013-09-08 Thread Sven Barth
On 08.09.2013 10:44, Jürgen Hestermann wrote: Am 2013-09-07 21:46, schrieb Bart: > On 9/7/13, Jürgen Hestermann wrote: >> Of course! Why the hell should there be double pathdelims? And why >> (silently) accept them as if they were one? > There should not be, but (history: DOS and) WinApi acc

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

2013-09-08 Thread Mattias Gaertner
On Sun, 08 Sep 2013 19:32:23 +0200 Sven Barth wrote: > On 08.09.2013 14:17, Bart wrote: > > On 9/8/13, Tomas Hajny wrote: > > > >> Why do you believe that ExpandFilename is not threadsafe (on Windows or > >> any other platform)? >[...] > > And that is exactly the point. > > GetDir calls GetCuren

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

2013-09-08 Thread Tomas Hajny
On Sun, September 8, 2013 19:32, Sven Barth wrote: > On 08.09.2013 14:17, Bart wrote: >> On 9/8/13, Tomas Hajny wrote: >> >>> Why do you believe that ExpandFilename is not threadsafe (on Windows or >>> any other platform)? >> .. >>> The only platform specific part inside >>> ExpandFilename is a ca

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

2013-09-08 Thread Tomas Hajny
On Sun, September 8, 2013 19:21, Bart wrote: > On 9/8/13, Tomas Hajny wrote: . . >> Good, thanks for the pointer. We may indeed want to add some safeguards >> to >> the Windows GetDir implementation (or possibly check some alternative >> solution for finding out the current directory on other dr