[fpc-devel]small bug

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Fri Jan 16 20:36:28 CET 2004


On Fri, 16 Jan 2004, Johannes Berg wrote:

> The windows version for DirectoryExists has a bug:
> 
> Function DirectoryExists (Const Directory : String) : Boolean;
> var
>   Handle: THandle;
>   FindData: TWin32FindData;
> begin
>   Handle := FindFirstFile(Pchar(Directory), FindData);
>   Result:=(Handle <> INVALID_HANDLE_VALUE) and
>           ((FindData.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY)
>   If Result then
>     Windows.FindClose(Handle);
> end;
> 
> It doesn't close the find handle if whatever it found wasn't a directory.

Thanks, fixed.

Michael.




More information about the fpc-devel mailing list