summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2021-02-02 13:45:39 +0100
committerErich Eckner <git@eckner.net>2021-02-02 13:45:39 +0100
commit1df33a8f13e06ef27fbd095e511909904adeda24 (patch)
treee45c3d6c1b5025c84e0487ced2eb4b6a004de97f
parentda7fb46d70ead949fa805ca72419c0b2abce546e (diff)
downloadunits-1df33a8f13e06ef27fbd095e511909904adeda24.tar.xz
lowlevelunit.pas: findeRekursiv() neu
-rw-r--r--lowlevelunit.pas29
1 files changed, 29 insertions, 0 deletions
diff --git a/lowlevelunit.pas b/lowlevelunit.pas
index e87e383..59bad32 100644
--- a/lowlevelunit.pas
+++ b/lowlevelunit.pas
@@ -184,6 +184,8 @@ function unEscapeCommas(s: string): string;
function escape(s,toe,es: string): string;
function escapeStringToRegex(s: string; typ: tRegexTyp; extras: string = ''): string; inline;
+function findeRekursiv(pfad,muster: string; out datei: string): boolean;
+
var
base64Chars: array[0..63] of char;
base64CharsInvers: array[char] of byte;
@@ -1515,6 +1517,33 @@ begin
end{of case};
end;
+function findeRekursiv(pfad,muster: string; out datei: string): boolean;
+var
+ sr: tSearchRec;
+ err: integer;
+begin
+ result:=false;
+ err:=findFirst(pfad+'/'+muster,faAnyFile and not faDirectory,sr);
+ while (err=0) and not result do begin
+ if (sr.attr and faDirectory)=0 then begin
+ result:=true;
+ datei:=pfad+'/'+sr.name;
+ break;
+ end;
+ err:=findNext(sr);
+ end;
+ findClose(sr);
+ if result then
+ exit;
+ err:=findFirst(pfad+'/*',faAnyFile,sr);
+ while (err=0) and not result do begin
+ if (sr.name<>'.') and (sr.name<>'..') and ((sr.attr and faDirectory)<>0) then
+ result:=findeRekursiv(pfad+'/'+sr.name,muster,datei);
+ err:=findNext(sr);
+ end;
+ findClose(sr);
+end;
+
var
b: byte;