[Lazarus] How to get the version of .lpk?

silvioprog silvioprog at gmail.com
Thu Nov 24 03:23:30 CET 2011


2011/11/23 silvioprog <silvioprog at gmail.com>:
[...]
> I tried this:
>
> http://wiki.lazarus.freepascal.org/Extending_the_IDE#Search_a_package_with_a_name
>
> But when I use the unit "PackageIntf", my IDE don't starts. The error:
> "List index (-1) out of bounds"

Hmm, FindPackageWithName not find the package, I tested with 'LCL'
package. But this code works fine:

var
  I: Integer;
  VPkg: TIDEPackage;
begin
  for I := 0 to Pred(PackageEditingInterface.GetPackageCount) do
  begin
    VPkg := PackageEditingInterface.FindPackageWithName(I);
    if SameText(VPkg.Name, 'mypkg') then
    begin
      ShowMessage(Format('%d.%d.%d', [VPkg.Version.Major, VPkg.Version.Release,
        VPkg.Version.Build]));
      Break;
    end;
  end;
end;

-- 
Silvio Clécio
===============================================
Blog - <silvioprog.com.br>
Twitter - <twitter.com/silvioprog>
Facebook - <facebook.com/silvioprog>
LazSolutions - <code.google.com/p/lazsolutions>
Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR>
===============================================
   * Conheça nosso canal IRC sobre Lazarus: #lazarus-br *
===============================================




More information about the Lazarus mailing list