1{ $Id$ } 2{ 3 /*************************************************************************** 4 startlazarus.lpr 5 -------------------- 6 This is a wrapper to (re)start lazarus. 7 8 ***************************************************************************/ 9 10 *************************************************************************** 11 * * 12 * This source is free software; you can redistribute it and/or modify * 13 * it under the terms of the GNU General Public License as published by * 14 * the Free Software Foundation; either version 2 of the License, or * 15 * (at your option) any later version. * 16 * * 17 * This code is distributed in the hope that it will be useful, but * 18 * WITHOUT ANY WARRANTY; without even the implied warranty of * 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 20 * General Public License for more details. * 21 * * 22 * A copy of the GNU General Public License is available on the World * 23 * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also * 24 * obtain it by writing to the Free Software Foundation, * 25 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 26 * * 27 *************************************************************************** 28} 29program StartLazarus; 30 31{$mode objfpc}{$H+} 32 33uses 34 redirect_stderr, 35 Interfaces, SysUtils, 36 Forms, 37 IDEInstances, 38 LazarusManager; 39 40{$R *.res} 41 42var 43 ALazarusManager: TLazarusManager; 44 45begin 46 redirect_stderr.DoShowWindow := False; 47 Application.Initialize; 48 ALazarusManager := TLazarusManager.Create(nil); 49 try 50 // parse params 51 ALazarusManager.Initialize; 52 // if started by lazarus, wait for it to exit 53 ALazarusManager.WaitForLazarus; 54 55 // if there is a lazarus instance accepting files, pass files to that 56 LazIDEInstances.PerformCheck; 57 if not LazIDEInstances.StartIDE then 58 Exit; 59 60 // start lazarus 61 ALazarusManager.Run; 62 finally 63 FreeAndNil(ALazarusManager); 64 end; 65end. 66 67