mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 14:00:18 +02:00
added default session if no lps file found
git-svn-id: trunk@9076 -
This commit is contained in:
parent
afd0d47005
commit
7072bbe773
@ -1902,6 +1902,31 @@ var
|
||||
FJumpHistory.LoadFromXMLConfig(xmlconfig,Path+'');
|
||||
end;
|
||||
|
||||
procedure LoadDefaultSession;
|
||||
var
|
||||
AnUnitInfo: TUnitInfo;
|
||||
BestUnitInfo: TUnitInfo;
|
||||
begin
|
||||
if FirstUnitWithEditorIndex<>nil then exit;
|
||||
|
||||
AnUnitInfo:=FirstPartOfProject;
|
||||
BestUnitInfo:=nil;
|
||||
while AnUnitInfo<>nil do begin
|
||||
if (BestUnitInfo=nil)
|
||||
or (FilenameIsPascalUnit(AnUnitInfo.Filename)
|
||||
and (not FilenameIsPascalUnit(BestUnitInfo.Filename)))
|
||||
then begin
|
||||
BestUnitInfo:=AnUnitInfo;
|
||||
end;
|
||||
AnUnitInfo:=AnUnitInfo.NextPartOfProject;
|
||||
end;
|
||||
if BestUnitInfo<>nil then begin
|
||||
BestUnitInfo.EditorIndex:=0;
|
||||
ActiveEditorIndexAtStart:=0;
|
||||
BestUnitInfo.Loaded:=true;
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
Path: String;
|
||||
xmlconfig: TXMLConfig;
|
||||
@ -1983,8 +2008,8 @@ begin
|
||||
|
||||
// load session file (if available)
|
||||
if (SessionStorage in [pssInProjectDir,pssInIDEConfig])
|
||||
and (CompareFilenames(ProjectInfoFile,ProjectSessionFile)<>0)
|
||||
and FileExists(ProjectSessionFile) then begin
|
||||
and (CompareFilenames(ProjectInfoFile,ProjectSessionFile)<>0) then begin
|
||||
if FileExists(ProjectSessionFile) then begin
|
||||
//DebugLn('TProject.ReadProject loading Session ProjectSessionFile=',ProjectSessionFile);
|
||||
try
|
||||
xmlconfig := TXMLConfig.Create(ProjectSessionFile);
|
||||
@ -2021,7 +2046,10 @@ begin
|
||||
end;
|
||||
xmlconfig:=nil;
|
||||
end;
|
||||
|
||||
end else begin
|
||||
// there is no .ps file -> create some defaults
|
||||
LoadDefaultSession;
|
||||
end;
|
||||
end;
|
||||
|
||||
finally
|
||||
|
Loading…
Reference in New Issue
Block a user