IDE: using process Executable instead of CommandLine

git-svn-id: trunk@51678 -
This commit is contained in:
mattias 2016-02-23 11:10:42 +00:00
parent dabcac3009
commit 85acb5b2f9

View File

@ -6895,9 +6895,9 @@ const
StartLazProcess : TProcessUTF8; StartLazProcess : TProcessUTF8;
ExeName : string; ExeName : string;
Params : TStrings; Params : TStrings;
Dummy : Integer; Dummy , i: Integer;
Unused : boolean; Unused : boolean;
CmdLine: string; aParam: string;
begin begin
StartLazProcess := TProcessUTF8.Create(nil); StartLazProcess := TProcessUTF8.Create(nil);
try try
@ -6922,18 +6922,23 @@ const
exit; exit;
end; end;
//DebugLn('Setting CommandLine'); //DebugLn('Setting CommandLine');
CmdLine := ExeName + StartLazProcess.Executable:=ExeName;
' --lazarus-pid='+IntToStr(GetProcessID) + ' '+ StartLazProcess.Parameters.Add('--lazarus-pid='+IntToStr(GetProcessID));
GetCommandLineParameters(Params, False); StartLazProcess.Parameters.AddStrings(Params);
DebugLn('Hint: (lazarus) CommandLine 1 : %s', [CmdLine]); i:=StartLazProcess.Parameters.Count-1;
while (i>=0) do begin
aParam:=StartLazProcess.Parameters[i];
if (LeftStr(aParam,length(PrimaryConfPathOptLong))=PrimaryConfPathOptLong)
or (LeftStr(aParam,length(PrimaryConfPathOptShort))=PrimaryConfPathOptShort)
then break;
dec(i);
end;
if (pos(PrimaryConfPathOptLong, CmdLine) = 0) and if i<0 then
(pos(PrimaryConfPathOptShort, CmdLine) = 0) then StartLazProcess.Parameters.Add(PrimaryConfPathOptLong + GetPrimaryConfigPath);
CmdLine := CmdLine + ' "' + PrimaryConfPathOptLong + GetPrimaryConfigPath+'"';
DebugLn('Hint: (lazarus) CommandLine 2 : %s', [CmdLine]); DebugLn('Hint: (lazarus) CmdLine=[',StartLazProcess.Executable,' ',MergeCmdLineParams(StartLazProcess.Parameters),']');
StartLazProcess.CommandLine := CmdLine;
StartLazProcess.Execute; StartLazProcess.Execute;
finally finally
FreeAndNil(Params); FreeAndNil(Params);