summaryrefslogtreecommitdiff
path: root/packages/fcl-base/examples/showver.pp
blob: b818e53472133aacdca8194f7cf455cbd09d7678 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
program showversion;

{$mode fpc}
{$R showver.res}

uses sysutils,fileinfo;

Var version : TFileVersionInfo;
    I : longint;

begin
  if Paramcount<1 then
    begin
      Writeln('Usage: showver <exefile>');
      halt(1);
    end;
  Version:=TFileVErsionInfo.create(Nil);
  Version.FileName:=paramstr(1);
  With Version do
    begin
    if Not FileExists(Paramstr(1)) then
      begin
      Writeln (Format('%s : No such file or directory',[Paramstr(1)]));
      Halt(1);
      end;
    FileName:=Paramstr(1);
    If VersionStrings.Count=0 then
      begin
      Writeln (Format('%s : No version information found.',[paramstr(1)]));
      Halt(2);
      end;
    For i:=0 to VersionStrings.Count-1 do
      Writeln (VersionCategories[I],'=',VersionStrings[i]);
    free;
    end;
end.