Lazarus中文社区

 找回密码
 立即注册(注册审核可向QQ群索取)

QQ登录

只需一步,快速开始

Lazarus IDE and 组件 下载地址版权申明
查看: 2440|回复: 11

请问,Linux下如何获取应用程序的版本信息呢 ?

[复制链接]

该用户从未签到

发表于 2022-2-21 17:54:31 | 显示全部楼层 |阅读模式
各位前辈,Lazarus在Linux下,如何 获取应用程序的版本信息 呢 ?
回复

使用道具 举报

该用户从未签到

发表于 2022-5-29 08:40:06 | 显示全部楼层

RE: 请问,Linux下如何获取应用程序的版本信息呢 ?

https://www.cnblogs.com/qiufeng2014/p/16322802.html
program printfileinfo;

{
  Displays file version info for
- Windows PE executables
- Linux ELF executables (compiled by Lazarus)
- macOS MACH-O executables (compiled by Lazarus)
  Runs on Windows, Linux, macOS
}

{$mode objfpc}{$H+}
{$ifdef mswindows}{$apptype console}{$endif}
uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes,sysutils
  // FPC 3.0 fileinfo reads exe resources as long as you register the appropriate units
  , fileinfo
  , winpeimagereader {need this for reading exe info}
  , elfreader {needed for reading ELF executables}
  , machoreader {needed for reading MACH-O executables}
  ;

var
  FileVerInfo: TFileVersionInfo;

{$R *.res}

begin
  FileVerInfo:=TFileVersionInfo.Create(nil);
  try
    FileVerInfo.ReadFileInfo;
    writeln('Company: ',FileVerInfo.VersionStrings.Values['CompanyName']);
    writeln('File description: ',FileVerInfo.VersionStrings.Values['FileDescription']);
    writeln('File version: ',FileVerInfo.VersionStrings.Values['FileVersion']);
    writeln('Internal name: ',FileVerInfo.VersionStrings.Values['InternalName']);
    writeln('Legal copyright: ',FileVerInfo.VersionStrings.Values['LegalCopyright']);
    writeln('Original filename: ',FileVerInfo.VersionStrings.Values['OriginalFilename']);
    writeln('Product name: ',FileVerInfo.VersionStrings.Values['ProductName']);
    writeln('Product version: ',FileVerInfo.VersionStrings.Values['ProductVersion']);
  finally
    FileVerInfo.Free;
  end;
end.
回复 支持 反对

使用道具 举报

*滑块验证:

本版积分规则

QQ|手机版|小黑屋|Lazarus中国|Lazarus中文社区 ( 鄂ICP备16006501号-1 )

GMT+8, 2025-5-2 10:51 , Processed in 0.028380 second(s), 13 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表