From be6ea9d712f9c4c7ecd3b89d3b7e20a31160377e Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Thu, 7 Jul 2016 20:52:01 +0200 Subject: [PATCH] libman, output a message when a library item is selected but deactivated --- src/ce_libman.pas | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/ce_libman.pas b/src/ce_libman.pas index c875b784..b0ba8b2b 100644 --- a/src/ce_libman.pas +++ b/src/ce_libman.pas @@ -89,6 +89,7 @@ type strict private fCollection: TCollection; fItemsByAlias: TItemsByAlias; + fMsgs: ICEMessagesDisplay; function getLibraryByIndex(index: integer): TLibraryItem; function getLibraryByAlias(const value: string): TLibraryItem; function getLibraryByImport(const value: string): TLibraryItem; @@ -135,6 +136,10 @@ var implementation +const + deactivatedMessage = 'Library item "%s" could be detected but it is marked disabled, ' + + 'the compilation will fail.'; + constructor TModuleInfo.Create(ACollection: TCollection); begin inherited create(ACollection); @@ -544,14 +549,22 @@ var lib: TLibraryItem; i: Integer; begin + if fMsgs = nil then + fMsgs := getMessageDisplay; // no selector = all libs if aliases.isNil then begin for i:= 0 to librariesCount-1 do begin lib := libraryByIndex[i]; - if lib.enabled and lib.hasValidLibSourcePath then - list.Add('-I' + lib.libSourcePath); + if lib.hasValidLibSourcePath then + begin + if not lib.enabled then + fMsgs.message(format(deactivatedMessage, [lib.libAlias]), + nil, amcAutoCompile, amkWarn) + else + list.Add('-I' + lib.libSourcePath); + end; end; end // else get selected libs @@ -574,6 +587,8 @@ var dep: TLibraryItem; sel: TLibraryList; begin + if fMsgs = nil then + fMsgs := getMessageDisplay; imp := TStringList.Create; sel := TLibraryList.create; try @@ -604,8 +619,14 @@ begin begin while true do if data.hasValidLibFile then begin - libs.Add(Data.libFile); - paths.Add('-I' + Data.libSourcePath); + if not data.enabled then + fMsgs.message(format(deactivatedMessage, [data.libAlias]), + nil, amcAutoCompile, amkWarn) + else + begin + libs.Add(Data.libFile); + paths.Add('-I' + Data.libSourcePath); + end; if not Next then break; end;