From 240c08a61eecd7207a7a38f0c681679fc6cbfcce Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sat, 9 Aug 2014 23:24:21 +0200 Subject: [PATCH] fix folder of lib files were not scanned --- src/ce_libman.pas | 32 ++++++++++++++++++++++++++++---- src/ce_libmaneditor.pas | 1 - 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/ce_libman.pas b/src/ce_libman.pas index 83f8828f..14d91b30 100644 --- a/src/ce_libman.pas +++ b/src/ce_libman.pas @@ -87,16 +87,40 @@ end; procedure TLibraryManager.getLibFiles(const someAliases, aList: TStrings); var itm: TLibraryItem; - i: NativeInt; + lst: TStringList; + i, j: NativeInt; begin for i := 0 to fCol.Count-1 do begin itm := TLibraryItem(fCol.Items[i]); if someAliases <> nil then if someAliases.IndexOf(itm.libAlias) = -1 then continue; - // - if aList.IndexOf(itm.libFile) <> -1 then continue; - aList.Add(itm.libFile); + // single lib files + if fileExists(itm.libFile) then + 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; diff --git a/src/ce_libmaneditor.pas b/src/ce_libmaneditor.pas index d73beb7c..2d1f3b53 100644 --- a/src/ce_libmaneditor.pas +++ b/src/ce_libmaneditor.pas @@ -90,7 +90,6 @@ begin filename := ini; if execute then begin - //TODO-cwiki: 'a folder containing many .lib can be added with an invalid fname' if not fileExists(filename) then List.Selected.SubItems[0] := extractFilePath(filename) else