[fpc-devel] FindFirst broken due to ExpandFileName bug?

Michael Van Canneyt michael at freepascal.org
Wed Sep 14 22:13:42 CEST 2005



On Mon, 12 Sep 2005, Tony Maro wrote:

> I just tried to use FindFirst to get a listing of files in a directory.  I
> passed FindFirst the following:
> 
>    if FindFirst('/home/tony/test/*',faAnyFile, Res) < 0 then begin
> 
> It never would return any results.  Then I noticed that FindFirst calls:
> 
> GlobSearchRec^.Path:=ExpandFileName(ExtractFilePath(Path));
> 
> So I ran:
> 
>    ExpandFileName(ExtractFilePath('/home/tony/test/*'));
> 
> And I got:
> 
>    /home/tony/LazarusFiles/testapp/"/home/tony/test/

Do you still have this bug ? 
The most recent compiler/rtl gives the following, which is IMHO correct:

-----------------------------------------------------------------------
home: >ppc386 testp.pp
home: >./testp
/home/michael/
home: >cd fpc
home: >~/testp
/home/michael/
home: >cat ~/testp.pp
program testp;

uses sysutils;

begin
  Writeln(ExpandFileName(ExtractFilePath('/home/michael/*')));
end.
home: >    
-----------------------------------------------------------------------


Michael.



More information about the fpc-devel mailing list