[Lazarus] How to get the package version from a LPK file?
Mattias Gaertner
nc-gaertnma at netcologne.de
Tue Nov 29 08:31:26 CET 2011
On Tue, 29 Nov 2011 08:55:39 +0200
Graeme Geldenhuys <graemeg.lists at gmail.com> wrote:
> On 29/11/2011, Graeme Geldenhuys <graemeg.lists at gmail.com> wrote:
> > And to be clear, as a programmer, this is the API interface I would
> > expect to use... which I don't think is unreasonable. Obviously this
> > doesn't work, but hey, that's XML for you.
> >
> > ReadXMLFile(VXML, ExtractFilePath(ParamStr(0)) + 'LazSolutionsDT.lpk');
> > n := vxml.FindNode('/Config/Package/Version');
> > n.Attributes.GetNamedItem('Major');
> > n.Attributes.GetNamedItem('Minor');
>
>
>
> PS:
> I'm very curious to know what the actual solution is though.
uses laz2_xmlcfg
cfg:=TXMLConfig.Create('/path/to/package.lpk');
writeln(cfg.GetValue('Package/Version/Major',''));
writeln(cfg.GetValue('Package/Version/Minor',''));
writeln(cfg.GetValue('Package/Version/Release',''));
writeln(cfg.GetValue('Package/Version/Build',''));
cfg.Free;
Mattias
More information about the Lazarus
mailing list