Skip to content
Permalink
Browse files

Issue #140: remove a tab section from tabs.ini within RestoreTabs(), …

…if its file does not exist
  • Loading branch information...
ansgarbecker committed Apr 10, 2019
1 parent 430ea3b commit f4c15030516011ae571b870ff7f96fac42d0a8a1
Showing with 19 additions and 9 deletions.
  1. +19 −9 source/main.pas
@@ -2203,16 +2203,26 @@ procedure TMainForm.RestoreTabs;
Filename := TabsIni.ReadString(Section, 'Filename', '');
BackupFilename := TabsIni.ReadString(Section, 'BackupFilename', '');
if not BackupFilename.IsEmpty then begin
Tab := ActiveOrEmptyQueryTab(False);
Tab.Uid := Section;
Tab.LoadContents(BackupFilename, True, TEncoding.UTF8);
Tab.MemoFilename := Filename;
Tab.Memo.Modified := True;
if FileExists(BackupFilename) then begin
Tab := ActiveOrEmptyQueryTab(False);
Tab.Uid := Section;
Tab.LoadContents(BackupFilename, True, TEncoding.UTF8);
Tab.MemoFilename := Filename;
Tab.Memo.Modified := True;
end else begin
// Remove ini item if file is gone
TabsIni.EraseSection(Section);
end;
end else if not Filename.IsEmpty then begin
Tab := ActiveOrEmptyQueryTab(False);
Tab.Uid := Section;
Tab.LoadContents(Filename, True, nil);
Tab.MemoFilename := Filename;
if FileExists(Filename) then begin
Tab := ActiveOrEmptyQueryTab(False);
Tab.Uid := Section;
Tab.LoadContents(Filename, True, nil);
Tab.MemoFilename := Filename;
end else begin
// Remove ini item if file is gone
TabsIni.EraseSection(Section);
end;
end;
end;
Sections.Free;

0 comments on commit f4c1503

Please sign in to comment.
You can’t perform that action at this time.