[fpc-pascal] FileExists inconsistency
    Daniël Mantione 
    daniel.mantione at freepascal.org
       
    Wed Jan  3 15:23:25 CET 2007
    
    
  
Op Wed, 3 Jan 2007, schreef Vincent Snijders:
> Henry Vermaak schreef:
> > Hi all
> > 
> > FileExists seems to be inconsistent between linux and windows.
> > FileExists in linux returns true for a directory, but not in windows.
> > The windows behaviour is consistent with Delphi, though, and I assume
> > that's correct.
> > 
> > Can anyone confirm or comment on this?
> > 
> 
> I can confirm this.
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.
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.
Daniël
    
    
More information about the fpc-pascal
mailing list