mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-08 14:07:11 +01:00
LazLogger: fix getting command line param. To not return include "=" from --debug-enable=foo. Issue #39520
This commit is contained in:
parent
7c60c7ce47
commit
7a876814d5
@ -383,11 +383,15 @@ end;
|
|||||||
function GetParamByNameCount(const AName: String): integer;
|
function GetParamByNameCount(const AName: String): integer;
|
||||||
var
|
var
|
||||||
i, l: Integer;
|
i, l: Integer;
|
||||||
|
s: String;
|
||||||
begin
|
begin
|
||||||
Result := 0;;
|
Result := 0;
|
||||||
l := Length(AName);
|
l := Length(AName);
|
||||||
for i:= 1 to Paramcount do begin
|
for i:= 1 to Paramcount do begin
|
||||||
if copy(ParamStrUTF8(i),1, l) = AName then
|
s := ParamStrUTF8(i);
|
||||||
|
if (copy(s, 1, l) = AName) and
|
||||||
|
((length(s) = l) or (s[l+1] = '='))
|
||||||
|
then
|
||||||
inc(Result);
|
inc(Result);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -395,13 +399,18 @@ end;
|
|||||||
function GetParamByName(const AName: String; AnIndex: Integer): string;
|
function GetParamByName(const AName: String; AnIndex: Integer): string;
|
||||||
var
|
var
|
||||||
i, l: Integer;
|
i, l: Integer;
|
||||||
|
s: String;
|
||||||
begin
|
begin
|
||||||
Result := '';
|
Result := '';
|
||||||
l := Length(AName);
|
l := Length(AName);
|
||||||
for i:= 1 to Paramcount do begin
|
for i:= 1 to Paramcount do begin
|
||||||
if copy(ParamStrUTF8(i),1, l) = AName then begin
|
s := ParamStrUTF8(i);
|
||||||
|
if (copy(s, 1, l) = AName) and
|
||||||
|
((length(s) = l) or (s[l+1] = '='))
|
||||||
|
then begin
|
||||||
dec(AnIndex);
|
dec(AnIndex);
|
||||||
if AnIndex < 0 then begin
|
if AnIndex < 0 then begin
|
||||||
|
inc(l); // skip = sign
|
||||||
Result := copy(ParamStrUTF8(i), l+1, Length(ParamStrUTF8(i))-l);
|
Result := copy(ParamStrUTF8(i), l+1, Length(ParamStrUTF8(i))-l);
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user