diff --git a/ide/idecmdline.pas b/ide/idecmdline.pas index 653cea60af..d485c7a803 100644 --- a/ide/idecmdline.pas +++ b/ide/idecmdline.pas @@ -43,7 +43,8 @@ interface uses Classes, SysUtils; -procedure ParseCommandLine(aCmdLineParams : TStrings; out IDEPid : Integer); +procedure ParseCommandLine(aCmdLineParams : TStrings; out IDEPid : Integer; + out ShowSplashScreen: boolean); function GetCommandLineParameters(aCmdLineParams : TStrings; isStartLazarus : Boolean = False) : String; @@ -65,7 +66,8 @@ function GetLazarusDirectory : String; implementation uses FileUtil, LazConf, LCLProc, LazarusIDEStrConsts; -procedure ParseCommandLine(aCmdLineParams : TStrings; out IDEPid : Integer); +procedure ParseCommandLine(aCmdLineParams: TStrings; out IDEPid: Integer; out + ShowSplashScreen: boolean); const LazarusPidOpt = '--lazarus-pid='; LazarusDebugOpt = '--debug'; @@ -89,6 +91,11 @@ begin IDEPid := 0; end; end + else if ParamIsOption(i, NoSplashScreenOptLong) or + ParamIsOption(i, NoSplashScreenOptShort) then + begin + ShowSplashScreen := false; + end else begin // Do not add file to the parameter list @@ -210,10 +217,10 @@ begin begin Filename := ParamStrUTF8(i); if (Filename = '') or (Filename[1] = '-') then - break; + continue; if Result = nil then Result := TStringList.Create; - Result.Insert(0,Filename); + Result.Add(Filename); end; end; diff --git a/ide/lazarusmanager.pas b/ide/lazarusmanager.pas index abe7cd3617..94a8f4a78e 100644 --- a/ide/lazarusmanager.pas +++ b/ide/lazarusmanager.pas @@ -81,7 +81,7 @@ uses {$IFDEF unix} BaseUnix, {$ENDIF} - Classes, SysUtils, Process, AsyncProcess, UTF8Process, + Classes, SysUtils, Process, UTF8Process, LCLProc, FileUtil, Forms, Controls, Dialogs, LazConf, Splash; @@ -110,6 +110,7 @@ type FLazarusPath: string; FLazarusPID: Integer; FCmdLineParams: TStrings; + FCmdLineFiles: string; FShowSplashOption: boolean; function RenameLazarusExecutable(const Directory: string): TModalResult; procedure LazarusProcessStart(Sender: TObject); @@ -214,13 +215,25 @@ begin end; procedure TLazarusManager.Initialize; +var + CmdLineFiles: TStrings; + i: integer; begin FShowSplashOption:=true; SplashForm := nil; FCmdLineParams := TStringList.Create; - ParseCommandLine(FCmdLineParams, FLazarusPID); + ParseCommandLine(FCmdLineParams, FLazarusPID, FShowSplashOption); if FShowSplashOption then ShowSplash; + CmdLineFiles := ExtractCmdLineFilenames; + if CmdLineFiles<>nil then + begin + for i := 0 to CmdLineFiles.Count-1 do + if pos(' ',CmdLineFiles[i])>0 then + CmdLineFiles[i] := '"' + CmdLineFiles[i] + '"'; + CmdLineFiles.Delimiter:=' '; + FCmdLineFiles:=CmdLineFiles.DelimitedText; + end; end; procedure TLazarusManager.Run; @@ -251,8 +264,9 @@ begin CustomDir:=AppendPathDelim(GetPrimaryConfigPath) + 'bin' + PathDelim; repeat - ShowSplash; Restart := false; + if FShowSplashOption then + ShowSplash; { There are four places where the newest lazarus exe can be: 1. in the same directory as the startlazarus exe 1.1 as lazarus.new(.exe) (if the executable was write locked (windows)) @@ -315,7 +329,7 @@ begin break; end; end; - {$IFDEF LCLCarbon} + {$IFDEF darwin} if FileExists(FLazarusPath+'.app') then begin // start the bundle instead FLazarusPath:=FLazarusPath+'.app/Contents/MacOS/'+ExtractFileName(FLazarusPath); @@ -323,14 +337,11 @@ begin {$ENDIF} DebugLn(['TLazarusManager.Run starting ',FLazarusPath,' ...']); - if not Assigned(FCmdLineParams) then - begin - FCmdLineParams := TStringList.Create; - ParseCommandLine(FCmdLineParams, FLazarusPID); - end; FLazarusProcess := TLazarusProcess.Create(FLazarusPath, - GetCommandLineParameters(FCmdLineParams, True)); + GetCommandLineParameters(FCmdLineParams, True)+' '+FCmdLineFiles); + // clear the command line files, so that they are passed only once. + FCmdLineFiles:=''; FLazarusProcess.OnStart := @LazarusProcessStart; FLazarusProcess.Execute; FLazarusProcess.WaitOnExit; diff --git a/ide/main.pp b/ide/main.pp index 9c15a1250c..a7fe865894 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -9797,6 +9797,7 @@ const ExeName : string; Params : TStrings; Dummy : Integer; + Unused : boolean; CmdLine: string; begin StartLazProcess := TProcessUTF8.Create(nil); @@ -9805,7 +9806,7 @@ const StartLazProcess.CurrentDirectory := GetLazarusDirectory; //DebugLn('Parsing commandLine: '); Params := TStringList.Create; - ParseCommandLine(Params, Dummy); + ParseCommandLine(Params, Dummy, Unused); //DebugLn('Done parsing CommandLine'); {$ifndef darwin} ExeName := AppendPathDelim(StartLazProcess.CurrentDirectory) + diff --git a/ide/startlazarus.lpi b/ide/startlazarus.lpi index f4bd24da24..c11d3e063b 100644 --- a/ide/startlazarus.lpi +++ b/ide/startlazarus.lpi @@ -1,9 +1,11 @@ - - + + + +