Skip to content

Commit ce94226

Browse files
committed
remove LazUtils dependencies
1 parent b749be2 commit ce94226

File tree

1 file changed

+72
-3
lines changed

1 file changed

+72
-3
lines changed

.github/workflows/make.pas

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
Classes,
66
SysUtils,
77
StrUtils,
8-
FileUtil,
98
Zipper,
109
fphttpclient,
1110
RegExpr,
@@ -40,6 +39,76 @@
4039
var
4140
ErrorCount: Integer = 0;
4241

42+
// ---------------------------------------------------------------------------
43+
// FCL/RTL-only helpers (replace FileUtil usage)
44+
// ---------------------------------------------------------------------------
45+
46+
function ReadFileToString(const AFileName: string): string;
47+
var
48+
Stream: TFileStream;
49+
Size: Int64;
50+
begin
51+
Result := '';
52+
Stream := TFileStream.Create(AFileName, fmOpenRead or fmShareDenyNone);
53+
try
54+
Size := Stream.Size;
55+
if Size <= 0 then
56+
Exit;
57+
SetLength(Result, Size);
58+
Stream.Position := 0;
59+
Stream.ReadBuffer(Pointer(Result)^, Size);
60+
finally
61+
Stream.Free;
62+
end;
63+
end;
64+
65+
function MatchesMaskSimple(const AFileName, AMask: string): Boolean;
66+
var
67+
LExt: string;
68+
begin
69+
LExt := LowerCase(ExtractFileExt(AFileName));
70+
71+
if AMask = '*.lpk' then
72+
Exit(LExt = '.lpk');
73+
74+
if AMask = '*.lpi' then
75+
Exit(LExt = '.lpi');
76+
77+
Result := False;
78+
end;
79+
80+
procedure FindAllFilesRecursive(const ADir, AMask: string; AList: TStrings);
81+
var
82+
Search: TSearchRec;
83+
DirPath: string;
84+
EntryPath: string;
85+
begin
86+
DirPath := IncludeTrailingPathDelimiter(ExpandFileName(ADir));
87+
88+
if FindFirst(DirPath + '*', faAnyFile, Search) = 0 then
89+
try
90+
repeat
91+
if (Search.Name = '.') or (Search.Name = '..') then
92+
Continue;
93+
94+
EntryPath := DirPath + Search.Name;
95+
96+
if (Search.Attr and faDirectory) <> 0 then
97+
FindAllFilesRecursive(EntryPath, AMask, AList)
98+
else if MatchesMaskSimple(Search.Name, AMask) then
99+
AList.Add(EntryPath);
100+
until FindNext(Search) <> 0;
101+
finally
102+
FindClose(Search);
103+
end;
104+
end;
105+
106+
function FindAllFilesList(const ASearchDir, AMask: string): TStringList;
107+
begin
108+
Result := TStringList.Create;
109+
FindAllFilesRecursive(ASearchDir, AMask, Result);
110+
end;
111+
43112
// ---------------------------------------------------------------------------
44113
// Logging helpers
45114
// ---------------------------------------------------------------------------
@@ -281,7 +350,7 @@ procedure RegisterAllPackages(const ASearchDir: string);
281350
List: TStringList;
282351
Each: string;
283352
begin
284-
List := FindAllFiles(ASearchDir, '*.lpk', True);
353+
List := FindAllFilesList(ASearchDir, '*.lpk');
285354
try
286355
for Each in List do
287356
RegisterPackage(Each);
@@ -299,7 +368,7 @@ procedure BuildAllProjects;
299368
List: TStringList;
300369
Each: string;
301370
begin
302-
List := FindAllFiles(Target, '*.lpi', True);
371+
List := FindAllFilesList(Target, '*.lpi');
303372
try
304373
for Each in List do
305374
if IsTestProject(Each) then

0 commit comments

Comments
 (0)