Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-11

How to get the version of .lpk?

9 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

silvioprog

Hi,

Is there any function to get the version of a LPK package?

The tag with the version in LPK: <Version Minor="2" Release="2" Build="2"/>

Thx.

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 * ===============================================

Reply by email

silvioprog
to silvioprog
silvioprog wrote 7 lines
Hi, Is there any function to get the version of a LPK package? The tag with the version in LPK: <Version Minor="2" Release="2" Build="2"/> Thx.

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"

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 * ===============================================

Reply by email

silvioprog
to silvioprog

2011/11/23 silvioprog :
[...]

Show quoted text 6 lines
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 * ===============================================

Reply by email

Mattias Gaertner
to silvioprog: I tried this: http://wiki.lazarus.freepascal.org/Extending_the_IDE#Search_a_package_with_a…
Show quoted text 15 lines
Em 23 de novembro de 2011 23:21, silvioprog escreveu: > Hi, > > Is there any function to get the version of a LPK package? > > The tag with the version in LPK: <Version Minor="2" Release="2" Build="2"/> > > Thx. 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"

What means "use"?
You can not use it in the initialization section of a unit, because the IDE was not created yet.

Mattias

Reply by email

silvioprog
to Mattias Gaertner: On Wed, 23 Nov 2011 23:21:05 -0200 Of a lpk file on disk or of a package loaded in the…

2011/11/24 Mattias Gaertner :

Of a lpk file on disk or of a package loaded in the IDE? Mattias

Loaded in the IDE. I tried the function FindPackageWithName, but it always returns me nil.

I'm using in an "About dialog" of my package:

http://imagebin.org/185421

With this codes:

1 - http://code.google.com/p/lazsolutions/source/browse/trunk/Forms/LSAboutFrm.pas#104 2 - http://code.google.com/p/lazsolutions/source/browse/trunk/Core/LSPackageIntf.pas#43

Thanks.

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 * ===============================================

Reply by email

silvioprog
to Mattias Gaertner: On Wed, 23 Nov 2011 23:49:17 -0200 What means "use"? You can not use it in the…

2011/11/24 Mattias Gaertner :
[...]

Show quoted text 5 lines
What means "use"? You can not use it in the initialization section of a unit, because the IDE was not created yet. Mattias

Sorry, I saw now. :)

The PackageEditingInterface is instanciated by IDE.

I solved the problem with this function:

http://code.google.com/p/lazsolutions/source/browse/trunk/Core/LSPackageIntf.pas#31

In my Lazarus "0.9.30.2 FPC 2.4.4 i386-win32-win32", the PackageEditingInterface.FindPackageWithName aways returns nil.

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 * ===============================================

Reply by email

silvioprog
to Mattias Gaertner

2011/11/24 Mattias Gaertner :

Show quoted text 14 lines
On Thu, 24 Nov 2011 07:35:38 -0200 silvioprog wrote: > 2011/11/24 Mattias Gaertner : > > Of a lpk file on disk or of a package loaded in the IDE? > > > > Mattias > > Loaded in the IDE. I tried the function FindPackageWithName, but it > always returns me nil. Fixed. Mattias

Thx! :)

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 * ===============================================

Reply by email