fix folder of lib files were not scanned

This commit is contained in:
Basile Burg 2014-08-09 23:24:21 +02:00
parent 7f80dea641
commit 240c08a61e
2 changed files with 28 additions and 5 deletions

View File

@ -87,16 +87,40 @@ end;
procedure TLibraryManager.getLibFiles(const someAliases, aList: TStrings); procedure TLibraryManager.getLibFiles(const someAliases, aList: TStrings);
var var
itm: TLibraryItem; itm: TLibraryItem;
i: NativeInt; lst: TStringList;
i, j: NativeInt;
begin begin
for i := 0 to fCol.Count-1 do for i := 0 to fCol.Count-1 do
begin begin
itm := TLibraryItem(fCol.Items[i]); itm := TLibraryItem(fCol.Items[i]);
if someAliases <> nil then if someAliases <> nil then
if someAliases.IndexOf(itm.libAlias) = -1 then continue; if someAliases.IndexOf(itm.libAlias) = -1 then continue;
// // single lib files
if aList.IndexOf(itm.libFile) <> -1 then continue; if fileExists(itm.libFile) then
aList.Add(itm.libFile); begin
if aList.IndexOf(itm.libFile) <> -1 then continue;
aList.Add(itm.libFile);
end
// folder of lib file
else if directoryExists(itm.libFile) then
begin
lst := TStringList.Create;
try
listFiles(lst, itm.libFile);
for j:= 0 to lst.Count-1 do
begin
{$IFDEF WINDOWS}
if extractFileExt(lst.Strings[j]) = '.lib' then
{$ELSE}
if extractFileExt(lst.Strings[j]) = '.a' then
{$ENDIF}
if aList.IndexOf(lst.Strings[j]) = -1 then
aList.Add(lst.Strings[j]);
end;
finally
lst.Free;
end;
end;
end; end;
end; end;

View File

@ -90,7 +90,6 @@ begin
filename := ini; filename := ini;
if execute then if execute then
begin begin
//TODO-cwiki: 'a folder containing many .lib can be added with an invalid fname'
if not fileExists(filename) then if not fileExists(filename) then
List.Selected.SubItems[0] := extractFilePath(filename) List.Selected.SubItems[0] := extractFilePath(filename)
else else