mirror of https://gitlab.com/basile.b/dexed.git
save a few cycles
This commit is contained in:
parent
511bf285aa
commit
a4e8358b82
|
@ -243,6 +243,7 @@ var
|
||||||
fls: string = '';
|
fls: string = '';
|
||||||
fle: string;
|
fle: string;
|
||||||
lne: string;
|
lne: string;
|
||||||
|
cnt: integer;
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
fModules.Clear;
|
fModules.Clear;
|
||||||
|
@ -253,13 +254,14 @@ begin
|
||||||
prj := loadProject(fLibProject, true);
|
prj := loadProject(fLibProject, true);
|
||||||
str := TStringList.Create;
|
str := TStringList.Create;
|
||||||
try
|
try
|
||||||
for i:= 0 to prj.sourcesCount-1 do
|
cnt := prj.sourcesCount-1;
|
||||||
|
for i:= 0 to cnt do
|
||||||
begin
|
begin
|
||||||
fle := prj.sourceAbsolute(i);
|
fle := prj.sourceAbsolute(i);
|
||||||
if not hasDlangSyntax(fle.extractFileExt) then
|
if not hasDlangSyntax(fle.extractFileExt) then
|
||||||
continue;
|
continue;
|
||||||
fls += fle;
|
fls += fle;
|
||||||
if i <> prj.sourcesCount-1 then
|
if i <> cnt then
|
||||||
fls += PathSeparator;
|
fls += PathSeparator;
|
||||||
end;
|
end;
|
||||||
getModulesImports(fls, str);
|
getModulesImports(fls, str);
|
||||||
|
@ -287,13 +289,14 @@ begin
|
||||||
str := TStringList.Create;
|
str := TStringList.Create;
|
||||||
try
|
try
|
||||||
listFiles(str, fLibSourcePath, true);
|
listFiles(str, fLibSourcePath, true);
|
||||||
for i:= 0 to str.Count-1 do
|
cnt := str.Count-1;
|
||||||
|
for i:= 0 to cnt do
|
||||||
begin
|
begin
|
||||||
fle := str[i];
|
fle := str[i];
|
||||||
if not hasDlangSyntax(fle.extractFileExt) then
|
if not hasDlangSyntax(fle.extractFileExt) then
|
||||||
continue;
|
continue;
|
||||||
fls += fle;
|
fls += fle;
|
||||||
if i <> str.Count-1 then
|
if i <> cnt then
|
||||||
fls += PathSeparator;
|
fls += PathSeparator;
|
||||||
end;
|
end;
|
||||||
str.Clear;
|
str.Clear;
|
||||||
|
@ -351,7 +354,6 @@ end;
|
||||||
|
|
||||||
destructor TLibraryManager.destroy;
|
destructor TLibraryManager.destroy;
|
||||||
begin
|
begin
|
||||||
ForceDirectoriesUTF8(getDocPath);
|
|
||||||
LibMan.saveToFile(getDocPath + libFname);
|
LibMan.saveToFile(getDocPath + libFname);
|
||||||
fItemsByAlias.Free;
|
fItemsByAlias.Free;
|
||||||
fCollection.Free;
|
fCollection.Free;
|
||||||
|
@ -377,44 +379,43 @@ procedure TLibraryManager.FPOObservedChanged(ASender: TObject; Operation:
|
||||||
TFPObservedOperation; Data: Pointer);
|
TFPObservedOperation; Data: Pointer);
|
||||||
var
|
var
|
||||||
i,j: integer;
|
i,j: integer;
|
||||||
obj: TObject;
|
|
||||||
lib: TLibraryItem;
|
lib: TLibraryItem;
|
||||||
cli: TLibraryItem;
|
cli: TLibraryItem;
|
||||||
dep: TLibraryItem;
|
dep: TLibraryItem;
|
||||||
begin
|
begin
|
||||||
if data.isNil then
|
if data.isNil then
|
||||||
exit;
|
exit;
|
||||||
obj := TObject(data);
|
|
||||||
if not (obj is TLibraryItem) then
|
if operation <> ooDeleteItem then
|
||||||
|
exit;
|
||||||
|
if not (TObject(data) is TLibraryItem) then
|
||||||
exit;
|
exit;
|
||||||
lib := TLibraryItem(data);
|
lib := TLibraryItem(data);
|
||||||
case operation of
|
if not fItemsByAlias.contains(lib.libAlias) then
|
||||||
ooDeleteItem: if fItemsByAlias.contains(lib.libAlias) then
|
exit;
|
||||||
|
|
||||||
|
for i:= 0 to lib.dependencies.Count-1 do
|
||||||
|
begin
|
||||||
|
dep := libraryByAlias[lib.dependencies[i]];
|
||||||
|
if assigned(dep) then
|
||||||
begin
|
begin
|
||||||
for i:= 0 to lib.dependencies.Count-1 do
|
j := dep.clients.IndexOf(lib.libAlias);
|
||||||
begin
|
if j <> -1 then
|
||||||
dep := libraryByAlias[lib.dependencies[i]];
|
dep.clients.Delete(j);
|
||||||
if assigned(dep) then
|
|
||||||
begin
|
|
||||||
j := dep.clients.IndexOf(lib.libAlias);
|
|
||||||
if j <> -1 then
|
|
||||||
dep.clients.Delete(j);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
for i:= 0 to lib.clients.Count-1 do
|
|
||||||
begin
|
|
||||||
cli := libraryByAlias[lib.clients[i]];
|
|
||||||
if assigned(cli) then
|
|
||||||
begin
|
|
||||||
j := cli.dependencies.IndexOf(lib.libAlias);
|
|
||||||
if j <> -1 then
|
|
||||||
cli.dependencies.Delete(j);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
DCDWrapper.remImportFolder(lib.libSourcePath);
|
|
||||||
fItemsByAlias.delete(lib.libAlias);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
for i:= 0 to lib.clients.Count-1 do
|
||||||
|
begin
|
||||||
|
cli := libraryByAlias[lib.clients[i]];
|
||||||
|
if assigned(cli) then
|
||||||
|
begin
|
||||||
|
j := cli.dependencies.IndexOf(lib.libAlias);
|
||||||
|
if j <> -1 then
|
||||||
|
cli.dependencies.Delete(j);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
DCDWrapper.remImportFolder(lib.libSourcePath);
|
||||||
|
fItemsByAlias.delete(lib.libAlias);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLibraryManager.updateAfterAddition(lib: TLibraryItem);
|
procedure TLibraryManager.updateAfterAddition(lib: TLibraryItem);
|
||||||
|
|
Loading…
Reference in New Issue