mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 17:59:16 +02:00
IDE: fixed restart on darwin with lazarus.cfg
git-svn-id: trunk@64249 -
This commit is contained in:
parent
a869c43f49
commit
bd0a307669
@ -65,6 +65,7 @@ procedure ParseCommandLine(aCmdLineParams: TStrings; out IDEPid : Integer;
|
|||||||
function GetCommandLineParameters(aCmdLineParams: TStrings;
|
function GetCommandLineParameters(aCmdLineParams: TStrings;
|
||||||
isStartLazarus: Boolean = False) : string;
|
isStartLazarus: Boolean = False) : string;
|
||||||
function ExtractPrimaryConfigPath(aCmdLineParams: TStrings): string;
|
function ExtractPrimaryConfigPath(aCmdLineParams: TStrings): string;
|
||||||
|
function ExpandParamFile(const s: string): string;
|
||||||
|
|
||||||
function IsHelpRequested : Boolean;
|
function IsHelpRequested : Boolean;
|
||||||
function IsVersionRequested : boolean;
|
function IsVersionRequested : boolean;
|
||||||
@ -282,6 +283,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function ExpandParamFile(const s: string): string;
|
||||||
|
var
|
||||||
|
p: string;
|
||||||
|
begin
|
||||||
|
Result:=s;
|
||||||
|
for p in [PrimaryConfPathOptLong,SecondaryConfPathOptLong,LazarusDirOpt] do
|
||||||
|
if LeftStr(Result,length(p))=p then
|
||||||
|
begin
|
||||||
|
Result:=LeftStr(Result,length(p))+ExpandFileNameUTF8(copy(Result,length(p)+1,length(Result)));
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function IsHelpRequested : Boolean;
|
function IsHelpRequested : Boolean;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
|
@ -483,6 +483,7 @@ begin
|
|||||||
debugln(['Debug: (lazarus) ',aPID,' TIDEInstances.StartUserBuiltIDE FileAge: Custom=',CustomExe,':',FileAgeUTF8(CustomExe),' < Default=',DefaultExe,':',FileAgeUTF8(DefaultExe)]);
|
debugln(['Debug: (lazarus) ',aPID,' TIDEInstances.StartUserBuiltIDE FileAge: Custom=',CustomExe,':',FileAgeUTF8(CustomExe),' < Default=',DefaultExe,':',FileAgeUTF8(DefaultExe)]);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
//debugln(['Debug: (lazarus) ',aPID,' TIDEInstances.StartUserBuiltIDE FileAge: Custom=',CustomExe,':',FileAgeUTF8(CustomExe),' >= Default=',DefaultExe,':',FileAgeUTF8(DefaultExe)]);
|
||||||
|
|
||||||
if DirectoryIsWritable(DefaultDir) then
|
if DirectoryIsWritable(DefaultDir) then
|
||||||
begin
|
begin
|
||||||
@ -520,7 +521,7 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
// append params, including the lazarus.cfg params
|
// append params, including the lazarus.cfg params
|
||||||
for i:=1 to CfgParams.Count-1 do
|
for i:=1 to CfgParams.Count-1 do
|
||||||
Params.Add(CfgParams[i]);
|
Params.Add(ExpandParamFile(CfgParams[i]));
|
||||||
aProcess.Parameters:=Params;
|
aProcess.Parameters:=Params;
|
||||||
debugln(['Note: (lazarus) ',aPID,' TIDEInstances.StartUserBuiltIDE Starting custom IDE: aProcess.Executable=',aProcess.Executable,' Params=[',Params.Text,']']);
|
debugln(['Note: (lazarus) ',aPID,' TIDEInstances.StartUserBuiltIDE Starting custom IDE: aProcess.Executable=',aProcess.Executable,' Params=[',Params.Text,']']);
|
||||||
aProcess.Execute;
|
aProcess.Execute;
|
||||||
|
@ -113,13 +113,13 @@ type
|
|||||||
FProcess: TProcessUTF8;
|
FProcess: TProcessUTF8;
|
||||||
FWantsRestart: boolean;
|
FWantsRestart: boolean;
|
||||||
public
|
public
|
||||||
constructor Create(const LazarusPath: string; const CommandLine: string;
|
constructor Create;
|
||||||
EnvOverrides: TStringList = nil);
|
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Execute;
|
procedure Execute;
|
||||||
procedure WaitOnExit;
|
procedure WaitOnExit;
|
||||||
property WantsRestart: boolean read FWantsRestart;
|
property WantsRestart: boolean read FWantsRestart;
|
||||||
property OnStart: TNotifyEvent read FOnStart write FOnStart;
|
property OnStart: TNotifyEvent read FOnStart write FOnStart;
|
||||||
|
property Process: TProcessUTF8 read FProcess;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -283,6 +283,8 @@ var
|
|||||||
MsgResult: TModalResult;
|
MsgResult: TModalResult;
|
||||||
StartPath: String;
|
StartPath: String;
|
||||||
EnvOverrides: TStringList;
|
EnvOverrides: TStringList;
|
||||||
|
Params: TStringListUTF8;
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
WaitForLazarus;
|
WaitForLazarus;
|
||||||
try
|
try
|
||||||
@ -380,10 +382,15 @@ begin
|
|||||||
|
|
||||||
DebugLn(['Info: (startlazarus) [TLazarusManager.Run] starting ',FLazarusPath,' ...']);
|
DebugLn(['Info: (startlazarus) [TLazarusManager.Run] starting ',FLazarusPath,' ...']);
|
||||||
EnvOverrides:=TStringList.Create;
|
EnvOverrides:=TStringList.Create;
|
||||||
|
Params:=TStringListUTF8.Create;
|
||||||
|
FLazarusProcess := TLazarusProcess.Create;
|
||||||
try
|
try
|
||||||
{$IFDEF Linux}
|
{$IFDEF Linux}
|
||||||
EnvOverrides.Values['LIBOVERLAY_SCROLLBAR']:='0';
|
EnvOverrides.Values['LIBOVERLAY_SCROLLBAR']:='0';
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
FLazarusProcess.Process.Executable:=fLazarusPath;
|
||||||
|
if (EnvOverrides<>nil) and (EnvOverrides.Count>0) then
|
||||||
|
AssignEnvironmentTo(FLazarusProcess.Process.Environment,EnvOverrides);
|
||||||
{$IFDEF darwin}
|
{$IFDEF darwin}
|
||||||
// "open" process runs a bundle, but doesn't wait for it to finish execution
|
// "open" process runs a bundle, but doesn't wait for it to finish execution
|
||||||
// "startlazarus" logic suggests that the Lazarus process would be waited
|
// "startlazarus" logic suggests that the Lazarus process would be waited
|
||||||
@ -391,20 +398,18 @@ begin
|
|||||||
// would repeat the restart process.
|
// would repeat the restart process.
|
||||||
// Since "open" doesn't play nice with "startlazarus" logic.
|
// Since "open" doesn't play nice with "startlazarus" logic.
|
||||||
// The arguments would not indicate that lazarus was started by startlazarus
|
// The arguments would not indicate that lazarus was started by startlazarus
|
||||||
FLazarusProcess :=
|
FLazarusProcess.Process.Executable:='/usr/bin/open';
|
||||||
TLazarusProcess.Create('open',
|
Params.Add('-a');
|
||||||
' -a ' + FLazarusPath + ' --args'
|
Params.Add(FLazarusPath);
|
||||||
+' '+NoSplashScreenOptLong
|
Params.Add('--args');
|
||||||
+' '+GetCommandLineParameters(FCmdLineParams, False)
|
|
||||||
+' '+FCmdLineFiles,
|
|
||||||
EnvOverrides);
|
|
||||||
{$ELSE}
|
|
||||||
FLazarusProcess :=
|
|
||||||
TLazarusProcess.Create(FLazarusPath,
|
|
||||||
GetCommandLineParameters(FCmdLineParams, True)+' '+FCmdLineFiles,
|
|
||||||
EnvOverrides);
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
Params.Add(NoSplashScreenOptLong);
|
||||||
|
Params.Add(StartedByStartLazarusOpt);
|
||||||
|
for i:=0 to FCmdLineParams.Count-1 do
|
||||||
|
Params.Add(ExpandParamFile(FCmdLineParams[i]));
|
||||||
|
FLazarusProcess.Process.Parameters.AddStrings(Params);
|
||||||
finally
|
finally
|
||||||
|
Params.Free;
|
||||||
EnvOverrides.Free;
|
EnvOverrides.Free;
|
||||||
end;
|
end;
|
||||||
// clear the command line files, so that they are passed only once.
|
// clear the command line files, so that they are passed only once.
|
||||||
@ -432,22 +437,12 @@ end;
|
|||||||
|
|
||||||
{ TLazarusProcess }
|
{ TLazarusProcess }
|
||||||
|
|
||||||
constructor TLazarusProcess.Create(const LazarusPath: string;
|
constructor TLazarusProcess.Create;
|
||||||
const CommandLine: string; EnvOverrides: TStringList);
|
|
||||||
var
|
|
||||||
Params: TStringListUTF8;
|
|
||||||
begin
|
begin
|
||||||
FProcess := TProcessUTF8.Create(nil);
|
FProcess := TProcessUTF8.Create(nil);
|
||||||
FProcess.InheritHandles := false;
|
FProcess.InheritHandles := false;
|
||||||
FProcess.Options := [];
|
FProcess.Options := [];
|
||||||
FProcess.ShowWindow := swoShow;
|
FProcess.ShowWindow := swoShow;
|
||||||
Params:=TStringListUTF8.Create;
|
|
||||||
SplitCmdLineParams(CommandLine,Params);
|
|
||||||
FProcess.Executable:=LazarusPath;
|
|
||||||
FProcess.Parameters:=Params;
|
|
||||||
Params.Free;
|
|
||||||
if (EnvOverrides<>nil) and (EnvOverrides.Count>0) then
|
|
||||||
AssignEnvironmentTo(FProcess.Environment,EnvOverrides);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TLazarusProcess.Destroy;
|
destructor TLazarusProcess.Destroy;
|
||||||
|
Loading…
Reference in New Issue
Block a user