starter: first check in the primary config directory for a Lazarus executable

git-svn-id: trunk@9882 -
This commit is contained in:
vincents 2006-09-13 09:37:02 +00:00
parent 193b2859bf
commit ec83a5bd03
5 changed files with 97 additions and 69 deletions

2
.gitattributes vendored
View File

@ -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

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="/"/>
<PathDelim Value="\"/>
<Version Value="5"/>
<General>
<Flags>
@ -22,7 +22,7 @@
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<Units Count="1">
@ -35,11 +35,12 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="../lazarus"/>
</Target>
<SearchPaths>
<UnitOutputDirectory Value="$(LazarusDir)/units/$(TargetCPU)-$(TargetOS)"/>
<UnitOutputDirectory Value="$(LazarusDir)\units\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>

View File

@ -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;

83
ide/startlazarus.lpi Normal file
View File

@ -0,0 +1,83 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
<Version Value="5"/>
<General>
<SessionStorage Value="InIDEConfig"/>
<MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=".exe"/>
</General>
<VersionInfo>
<UseVersionInfo Value="False"/>
<AutoIncrementBuild Value="False"/>
<CurrentVersionNr Value="0"/>
<CurrentMajorRevNr Value="0"/>
<CurrentMinorRevNr Value="0"/>
<CurrentBuildNr Value="0"/>
<ProjectVersion Value="1.0.0.0"/>
<Language Value="0409"/>
<CharSet Value="04E4"/>
<Comments Value=""/>
<CompanyName Value=""/>
<FileDescription Value=""/>
<InternalName Value=""/>
<LegalCopyright Value=""/>
<LegalTrademarks Value=""/>
<OriginalFilename Value=""/>
<ProductName Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="startlazarus.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="lazarusmanager.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="LazarusManager"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="D:\lazarus\source\lazarus\startlazarus.exe"/>
</Target>
<SearchPaths>
<UnitOutputDirectory Value="D:\lazarus\source\lazarus\units\i386-win32"/>
<SrcPath Value="$(LazarusDir)\lcl\;$(LazarusDir)\lcl\interfaces\$(LCLWidgetType)\"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</CONFIG>

View File

@ -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.