libman, remove deactivated or deleted entries from dcd

This commit is contained in:
Basile Burg 2018-08-10 00:55:24 +02:00
parent 0872eb54d0
commit cad8a59a94
1 changed files with 16 additions and 8 deletions

View File

@ -455,23 +455,31 @@ end;
procedure TLibraryManager.updateDCD; procedure TLibraryManager.updateDCD;
var var
itm: TLibraryItem; itm: TLibraryItem;
str: TStringList; add: TStringList;
rem: TStringList;
i: Integer; i: Integer;
begin begin
if not DcdWrapper.available then exit; if not DcdWrapper.available then
// note: new libraries are directly handled but those who are removed exit;
// remain in cache until next session.
str := TStringList.Create; add := TStringList.Create;
rem := TStringList.Create;
try try
for i := 0 to fCollection.Count-1 do for i := 0 to fCollection.Count-1 do
begin begin
itm := TLibraryItem(fCollection.Items[i]); itm := TLibraryItem(fCollection.Items[i]);
if itm.enabled then if itm.enabled then
str.Add(itm.libSourcePath); add.Add(itm.libSourcePath)
else
rem.Add(itm.libSourcePath);
end; end;
DcdWrapper.addImportFolders(str); if add.Count > 0 then
DcdWrapper.addImportFolders(add);
if rem.Count > 0 then
DCDWrapper.remImportFolders(rem);
finally finally
str.Free; add.Free;
rem.Free;
end; end;
end; end;