mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 09:38:12 +02:00
IDE: added safeguard against getting environmentstrings that start with '=' as can happen on windows. This fixes bug #1685 and #7699
git-svn-id: trunk@10331 -
This commit is contained in:
parent
cffc736d63
commit
a0507c6111
@ -47,11 +47,15 @@ Begin
|
||||
SysVarCount:=GetEnvironmentVariableCount;
|
||||
for i:=0 to SysVarCount-1 do begin
|
||||
Variable:=GetEnvironmentString(i+1);
|
||||
e:=1;
|
||||
while (e<=length(Variable)) and (Variable[e]<>'=') do inc(e);
|
||||
Value:=copy(Variable,e+1,length(Variable)-e);
|
||||
Variable:=LeftStr(Variable,e-1);
|
||||
Result.Values[Variable]:=Value;
|
||||
// On windows some (hidden) envirionment variables can be returned by
|
||||
// GetEnvironmentString. These kind of variables start with a =
|
||||
if (length(Variable)>0) and (Variable[1]<>'=') then begin
|
||||
e:=1;
|
||||
while (e<=length(Variable)) and (Variable[e]<>'=') do inc(e);
|
||||
Value:=copy(Variable,e+1,length(Variable)-e);
|
||||
Variable:=LeftStr(Variable,e-1);
|
||||
Result.Values[Variable]:=Value;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user