IDE: darwin: fixed run without debug and UseAppBundle, bug #31597

git-svn-id: trunk@54482 -
This commit is contained in:
mattias 2017-03-25 19:54:30 +00:00
parent f1d9980865
commit abd99ffb35
2 changed files with 20 additions and 17 deletions

View File

@ -584,7 +584,7 @@ end;
function TBuildManager.GetRunCommandLine: string;
var
TFN: string; // Target Filename
TargetFilename: string;
begin
Result := '';
if Project1=nil then exit;
@ -596,14 +596,16 @@ begin
Result := Project1.RunParameterOptions.CmdLineParams;
if GlobalMacroList.SubstituteStr(Result) then
begin
TFN := GetTargetFilename;
if (TFN <> '') and (TFN[Length(TFN)] in AllowDirectorySeparators) then
TFN += ExtractFileNameOnly(Project1.CompilerOptions.GetDefaultMainSourceFileName);
TFN := '"'+TFN+'"';
TargetFilename := GetTargetFilename;
if (TargetFilename <> '')
and (TargetFilename[Length(TargetFilename)] in AllowDirectorySeparators) then
TargetFilename += ExtractFileNameOnly(
Project1.CompilerOptions.GetDefaultMainSourceFileName);
TargetFilename := '"'+TargetFilename+'"';
if Result='' then
Result:=TFN
Result:=TargetFilename
else
Result:=TFN+' '+Result;
Result:=TargetFilename+' '+Result;
end else
Result:='';
end else begin

View File

@ -7041,6 +7041,7 @@ var
Process: TProcessUTF8;
ExeCmdLine, ExeWorkingDirectory: string;
ExeFileEnd, ExeFileStart: Integer;
RunAppBundle: Boolean;
begin
debugln(['TMainIDE.DoRunProjectWithoutDebug START']);
if Project1=nil then
@ -7060,8 +7061,10 @@ begin
end;
Process := TProcessUTF8.Create(nil);
try
RunAppBundle:={$IFDEF Darwin}true{$ELSE}false{$ENDIF};
RunAppBundle:=RunAppBundle and Project1.UseAppBundle;
if ExeCmdLine[1]='"' then
begin
ExeFileStart := 2;
@ -7076,7 +7079,13 @@ begin
Process.Executable := Copy(ExeCmdLine, ExeFileStart, ExeFileEnd-ExeFileStart);
Process.Parameters.Text := Copy(ExeCmdLine, ExeFileEnd+ExeFileStart, High(Integer));
if not FileIsExecutable(Process.Executable) then
if RunAppBundle and FileExistsUTF8(Process.Executable)
and FileExistsUTF8('/usr/bin/open') then
begin
Process.Parameters.Insert(0,Process.Executable);
Process.Executable := '/usr/bin/open';
end else if not FileIsExecutable(Process.Executable) then
begin
if Project1.RunParameterOptions.UseLaunchingApplication then
IDEMessageDialog(lisLaunchingApplicationInvalid,
@ -7107,14 +7116,6 @@ begin
Exit(mrNone);
end;
{$ifdef darwin}
if Project1.UseAppBundle then
begin
Process.Parameters.Insert(0,Process.Executable);
Process.Executable := '/usr/bin/open';
end;
{$endif}
Process.Execute;
finally
Process.Free;