Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi GetFiles und TFilterPredicate (https://www.delphipraxis.net/206962-getfiles-und-tfilterpredicate.html)

Willie1 12. Feb 2021 14:41

GetFiles und TFilterPredicate
 
Moin, Moin,
ich möchte aus einem Ordner nicht rekursiv alle Dateien mit der Endung .fus und der Dateigröße 2932 herausfiltern. Dazu bietet sich TDirectory.GetFiles an.
Ich habe mir mit Hilfe aus Stackoverflow das Folgende entwickelt:
Delphi-Quellcode:
function Filelist(const Path, Mask: string): TStringDynArray;
var
  SizeFilter: TDirectory.TFilterPredicate;
begin
  SizeFilter := function(const Path: string; const SR: TSearchRec): Boolean; //<------
  begin
    Result := SR.Size = 2932;
  end;

  Result := TDirectory.GetFiles(Path, Mask, SizeFilter);
end;
<--- Hier gibt es "Error 2029 Deklaration erwartet aber ; gefunden".
Kennt jemand die Lösung?
Willie.

DeddyH 12. Feb 2021 14:48

AW: GetFiles und TFilterPredicate
 
Lass mal in der markierten Zeile das Semikolon weg.

DieDolly 12. Feb 2021 14:49

AW: GetFiles und TFilterPredicate
 
Im Original ist das Semikolon auch weg. Warum hast da denn überhaupt erst eins hinzugefügt?
https://stackoverflow.com/questions/...-of-characters

Willie1 12. Feb 2021 14:55

AW: GetFiles und TFilterPredicate
 
Ihr habt Recht Leute. Bin's so gewohnt, da gehört ein Semikolon hin - hier aber nicht!
Danke. Willie.


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:47 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz