mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 16:49:00 +02:00
* Improvement of SysGetEnvironmentList by Alexey Torgashin. Fixes issue #40347
This commit is contained in:
parent
fd1f7b2ef8
commit
31edc46202
@ -176,22 +176,20 @@ Procedure SysGetEnvironmentList(List : TStrings;NamesOnly : Boolean);
|
||||
|
||||
var
|
||||
s : string;
|
||||
i,l,j,count : longint;
|
||||
i,j,count : longint;
|
||||
|
||||
begin
|
||||
count:=GetEnvironmentVariableCount;
|
||||
if count>0 then
|
||||
for j:=1 to count do
|
||||
begin
|
||||
s:=GetEnvironmentString(j);
|
||||
l:=Length(s);
|
||||
If NamesOnly then
|
||||
begin
|
||||
I:=pos('=',s);
|
||||
If (I>0) then
|
||||
S:=Copy(S,1,I-1);
|
||||
end;
|
||||
List.Add(S);
|
||||
for j:=1 to count do
|
||||
begin
|
||||
s:=GetEnvironmentString(j);
|
||||
If NamesOnly then
|
||||
begin
|
||||
I:=pos('=',s);
|
||||
If (I>1) then
|
||||
S:=Copy(S,1,I-1);
|
||||
end;
|
||||
List.Add(S);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user