[Lazarus] Retrieve VersionInfo at runtime

Graeme Geldenhuys graemeg.lists at gmail.com
Fri Jan 22 07:30:07 CET 2010


Luiz Americo Pereira Camara wrote:
> Is there a way to retrieve the version info that is stored in the 
> project file at runtime?


Instantiate a TProcess class and execute '<app> -v' (obviously your app
needs that command line param support) and read the output. This is the
safest way and most cross-platform way I could find.

I simply ignore the "version information" tab in the Project Settings
dialog, because it only works for one out of all the supported platforms
(windows).

You can even have a command line parameter that outputs similar "version
information" as that tab, but in the format key=value, so when you read
that output directly into a TStringList, it is even easier to parse and use.

Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/





More information about the Lazarus mailing list