lazarus-ccr/components/cmdlinecfg/trunk/testgetversion.lpr
skalogryz 6ee63d67b1 cmdlinecfg: the initial files commit
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2802 8e941d3f-bd1b-0410-a28a-d453659cc2b4
2013-10-02 03:46:44 +00:00

35 lines
742 B
ObjectPascal

program testgetversion;
{$mode delphi}{$H+}
uses
Classes, SysUtils, cmdlinecfg, cmdlinecfgutils, cmdlinecfgjson;
var
s : string;
list : TList;
cfg : TCmdLineCfg;
exe : string;
i : Integer;
begin
exe := 'fpc';
if ParamCount>0 then exe:=ParamStr(1);
writeln('executable: ', exe);
list := TList.Create;
try
CmdLineCfgJSONLoadFilesFromDir( GetCurrentDir, list );
writeln('found configurations: ', list.Count);
for i:=0 to list.Count-1 do
writeln( TCmdLineCfg(list[i]).Version );
cfg:=CmdLineCfgDetect( list, GetCurrentDir, exe);
if Assigned(cfg) then begin
writeln('version detected: ', cfg.Version);
end else
writeln('not found');
finally
list.Free;
end;
end.