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.

Mailing lists / lazarus / 2011-11
9 messages · 2 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
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"
2011/11/23 silvioprog :
[...]
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;Is there any function to get the version of a LPK package? The tag with the version in…
Of a lpk file on disk or of a package loaded in the IDE?
Mattias
I tried this: http://wiki.lazarus.freepascal.org/Extending_the_IDE#Search_a_package_with_a…
What means "use"?
You can not use it in the initialization section of a unit, because the IDE was not created yet.
Mattias
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:
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.
On Wed, 23 Nov 2011 23:49:17 -0200 What means "use"? You can not use it in the…
2011/11/24 Mattias Gaertner :
[...]
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.
2011/11/24 Mattias Gaertner : Loaded in the IDE. I tried the function…
Fixed.
Mattias
2011/11/24 Mattias Gaertner :
Thx! :)