From ec83a5bd034d060418a845a3e79db69f06ca821d Mon Sep 17 00:00:00 2001 From: vincents Date: Wed, 13 Sep 2006 09:37:02 +0000 Subject: [PATCH] starter: first check in the primary config directory for a Lazarus executable git-svn-id: trunk@9882 - --- .gitattributes | 2 +- ide/lazarus.lpi | 7 ++-- ide/lazarusmanager.pas | 16 ++++---- ide/startlazarus.lpi | 83 ++++++++++++++++++++++++++++++++++++++++++ ide/startlazopts.pas | 58 ----------------------------- 5 files changed, 97 insertions(+), 69 deletions(-) create mode 100644 ide/startlazarus.lpi delete mode 100644 ide/startlazopts.pas diff --git a/.gitattributes b/.gitattributes index 94dcfb8cf8..77c3e81ac5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1374,9 +1374,9 @@ ide/sourcemarks.pas svneol=native#text/pascal ide/splash.lfm svneol=native#text/plain ide/splash.lrs svneol=native#text/pascal ide/splash.pp svneol=native#text/pascal +ide/startlazarus.lpi svneol=native#text/plain ide/startlazarus.lpr svneol=native#text/pascal ide/startlazarus.rc svneol=native#text/plain -ide/startlazopts.pas svneol=native#text/pascal ide/sysvaruseroverridedlg.lfm svneol=native#text/plain ide/sysvaruseroverridedlg.lrs svneol=native#text/plain ide/sysvaruseroverridedlg.pas svneol=native#text/pascal diff --git a/ide/lazarus.lpi b/ide/lazarus.lpi index 2d0809e8a4..de87f6172e 100644 --- a/ide/lazarus.lpi +++ b/ide/lazarus.lpi @@ -1,7 +1,7 @@ - + @@ -22,7 +22,7 @@ - + @@ -35,11 +35,12 @@ + - + diff --git a/ide/lazarusmanager.pas b/ide/lazarusmanager.pas index 4ceb60cc3a..f119919add 100644 --- a/ide/lazarusmanager.pas +++ b/ide/lazarusmanager.pas @@ -83,8 +83,7 @@ uses {$ENDIF} Classes, SysUtils, Process, LCLProc, FileUtil, Forms, Controls, Dialogs, - LazConf, - StartLazOpts, Splash; + LazConf, Splash; type TLazarusProcess = class @@ -104,7 +103,6 @@ type type TLazarusManager = class(TComponent) private - FStartLazarusOptions: TStartLazarusOptions; FLazarusProcess: TLazarusProcess; FLazarusPath: string; FLazarusPID: Integer; @@ -130,14 +128,12 @@ begin inherited Create(nil); SplashForm := nil; ShowSplash; - FStartLazarusOptions := TStartLazarusOptions.Create; ParseCommandLine; end; destructor TLazarusManager.Destroy; begin FreeAndNil(FCmdLineParams); - FreeAndNil(FStartLazarusOptions); inherited Destroy; end; @@ -184,8 +180,14 @@ end; function TLazarusManager.GetLazarusPath(const FileName: string) : string; begin - Result := AppendPathDelim(FStartLazarusOptions.LazarusDir) + FileName + - GetExecutableExt; + // first try in the bin dir of the primary config directory + Result := AppendPathDelim(GetPrimaryConfigPath) + 'bin' + PathDelim + + FileName + GetExeExt; + // if no lazarus executable exists in that directory, try the same directory + // as the startlazarus executable + if not FileExists(Result) then + Result := AppendPathDelim(ExtractFilePath(ExpandFileName(ParamStr(0)))) + + FileName + GetExeExt; end; function TLazarusManager.RenameLazarusExecutables: TModalResult; diff --git a/ide/startlazarus.lpi b/ide/startlazarus.lpi new file mode 100644 index 0000000000..6bc06cd903 --- /dev/null +++ b/ide/startlazarus.lpi @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ide/startlazopts.pas b/ide/startlazopts.pas deleted file mode 100644 index f6bb589422..0000000000 --- a/ide/startlazopts.pas +++ /dev/null @@ -1,58 +0,0 @@ -{ $Id$ } -unit StartLazOpts; - -{$mode objfpc}{$H+} - -interface - -uses - Classes, SysUtils, - XMLCfg; - -type - TStartLazarusOptions = class - private - FFilename: string; - FLazarusDir: string; - procedure SetFilename(const AValue: string); - public - constructor Create; - destructor Destroy; override; - procedure Load; - procedure Save; - property LazarusDir: string read FLazarusDir write FLazarusDir; - property Filename: string read FFilename write SetFilename; - end; - -implementation - -{ TStartLazarusOptions } - -procedure TStartLazarusOptions.SetFilename(const AValue: string); -begin - if FFilename=AValue then exit; - FFilename:=AValue; -end; - -constructor TStartLazarusOptions.Create; -begin - FLazarusDir := ExtractFilePath(ExpandFileName(ParamStr(0))); -end; - -destructor TStartLazarusOptions.Destroy; -begin - inherited Destroy; -end; - -procedure TStartLazarusOptions.Load; -begin - -end; - -procedure TStartLazarusOptions.Save; -begin - -end; - -end. -