Op Wed, 3 Jan 2007, schreef Henry Vermaak:

> > There is no getting away that Dos filesystem handling is different
> > from Unix file handling. On Dos like platforms, a filename with
> > a same name as a subdirectory can exist in the same directory. In other
> > words, it should return false.
> > 
> 
> I cannot create a file with the same name as a subdir under Windows XP
> on ntfs or fat32...
> 
> > On the other hand, in Unix, it should return true because otherwise code
> > like:
> > 
> > if not fileexists('abcd') then
> > begin
> > assign(f,'abcd');
> > rewrite(f);
> > end;
> > 
> > ... becomes unreliable.
> > 
> 
> ...so that means that this code will also be unreliable on windows.
> In short: the 2 file systems are consistent with their behaviour in
> this respect, but the FileExists is not.
> 
> Maybe there's something I'm missing?

No, because in a Dos like filesystem, a direcory abcd will still allow a 
file abcd to be created. In other words, fileexists returns false so the 
file can be created.

In a Unix like filesystem, a directory abcd will prevent a file abcd to be 
created, so fileexists returns true.

In short, in Dos filesystems, directories are not considered files. In 
Unix filesystems they are considered files.

Daniël
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to