mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 12:40:34 +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;
|
SysVarCount:=GetEnvironmentVariableCount;
|
||||||
for i:=0 to SysVarCount-1 do begin
|
for i:=0 to SysVarCount-1 do begin
|
||||||
Variable:=GetEnvironmentString(i+1);
|
Variable:=GetEnvironmentString(i+1);
|
||||||
e:=1;
|
// On windows some (hidden) envirionment variables can be returned by
|
||||||
while (e<=length(Variable)) and (Variable[e]<>'=') do inc(e);
|
// GetEnvironmentString. These kind of variables start with a =
|
||||||
Value:=copy(Variable,e+1,length(Variable)-e);
|
if (length(Variable)>0) and (Variable[1]<>'=') then begin
|
||||||
Variable:=LeftStr(Variable,e-1);
|
e:=1;
|
||||||
Result.Values[Variable]:=Value;
|
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;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user