mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-29 05:44:28 +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
|
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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user