* Improvement of SysGetEnvironmentList by Alexey Torgashin. Fixes issue #40347

This commit is contained in:
Michaël Van Canneyt 2023-07-14 10:32:06 +02:00
parent fd1f7b2ef8
commit 31edc46202

View File

@ -176,22 +176,20 @@ Procedure SysGetEnvironmentList(List : TStrings;NamesOnly : Boolean);
var var
s : string; s : string;
i,l,j,count : longint; i,j,count : longint;
begin begin
count:=GetEnvironmentVariableCount; count:=GetEnvironmentVariableCount;
if count>0 then for j:=1 to count do
for j:=1 to count do begin
begin s:=GetEnvironmentString(j);
s:=GetEnvironmentString(j); If NamesOnly then
l:=Length(s); begin
If NamesOnly then I:=pos('=',s);
begin If (I>1) then
I:=pos('=',s); S:=Copy(S,1,I-1);
If (I>0) then end;
S:=Copy(S,1,I-1); List.Add(S);
end;
List.Add(S);
end; end;
end; end;