From 85567ecbddb234f8f1f0707911aeeee005a4372e Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Mon, 7 Jun 2004 10:27:08 +0000 Subject: [PATCH] Fixed: crash due to uncreated App.FVersion Added: OS.FormatVersion method --- X2UtApp.pas | 2 ++ X2UtOS.pas | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/X2UtApp.pas b/X2UtApp.pas index 42246e7..bb1cda9 100644 --- a/X2UtApp.pas +++ b/X2UtApp.pas @@ -254,6 +254,8 @@ constructor TX2App.Create; begin inherited; + FVersion := TX2AppVersion.Create(); + GetPath(); GetVersion(); end; diff --git a/X2UtOS.pas b/X2UtOS.pas index ca5017a..8370f6c 100644 --- a/X2UtOS.pas +++ b/X2UtOS.pas @@ -85,6 +85,11 @@ type constructor Create(); destructor Destroy(); override; + //:$ Returns the formatted version information + //:: If Build is False, the return value will not include the + //:: OS' Build number. + function FormatVersion(Build: Boolean = True): String; + //:$ Contains the detected OS version property Version: TX2OSVersion read FVersion; @@ -206,6 +211,21 @@ begin end; +function TX2OS.FormatVersion; +var + sBuild: String; + +begin + sBuild := ''; + + if Build then + sBuild := Format(' build %d', [FVersionEx.Build]); + + with FVersionEx do + Result := Format('%s %s%s', [Name, VersionString, sBuild]); +end; + + initialization finalization FreeAndNil(GOS);