Recent

Author Topic: Bug SysUtils.FindClose in Windows ?  (Read 2562 times)

bonmario

  • Sr. Member
  • ****
  • Posts: 346
Bug SysUtils.FindClose in Windows ?
« on: May 23, 2018, 07:49:06 pm »
Hi,
sorry for my bad english.
I'm using fpc 3.0.4.

See this code:
Code: Pascal  [Select][+][-]
  1. procedure TestFindFirst(WrkDir:String);
  2. var PathInfo: TSearchRec;
  3. begin
  4.   SysUtils.FindFirst(AppendPathDelim(WrkDir) + GetAllFilesMask, faDirectory, PathInfo);
  5.   SysUtils.FindClose(PathInfo);
  6.   {$IFDEF MSWINDOWS}
  7.     if (PathInfo.FindHandle <> -1) then begin
  8.   {$ENDIF}
  9.   {$IFDEF Linux}
  10.     if (PathInfo.FindHandle <> nil) then begin
  11.   {$ENDIF}
  12.       ShowMessage('Error !!!');
  13.     end else begin
  14.       ShowMessage('Ok ');
  15.     end;
  16.  
  17.   Halt;
  18. end;
  19.  

On Linux, using TestFindFirst, passing an existing directory, the value of "PathInfo.FindHandle" is nil.
On Windows, using TestFindFirst, passing an existing directory, the value of "PathInfo.FindHandle" that i expecting is -1, but result is the same value that it had before the call of "FindClose".

It's a bug?

Thanks in advance, Mario

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Bug SysUtils.FindClose in Windows ?
« Reply #1 on: May 24, 2018, 11:56:12 am »
Why would you need to use FindHandle?  It is for internal use only, you shouldn't use it unless you're modifying the RTL, are you?
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

bonmario

  • Sr. Member
  • ****
  • Posts: 346
Re: Bug SysUtils.FindClose in Windows ?
« Reply #2 on: May 24, 2018, 12:01:10 pm »
No, I'm just trying to understand the reason for a problem reported here:

https://forum.lazarus.freepascal.org/index.php/topic,41345.msg286830/topicseen.html#new

Sorry, but I thought I canceled this thread.

Hi, Mario

 

TinyPortal © 2005-2018