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
|
unit UnitFileInfos.mac;
interface
{$IFDEF TARGET_MAC}
function FileVersion(): string;
{$ENDIF}
implementation
{$IFDEF TARGET_MAC}
uses Macapi.CoreFoundation, Macapi.Foundation;
function FileVersion(): string;
var
CFStr: CFStringRef;
Range: CFRange;
begin
CFStr := CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle,
kCFBundleVersionKey);
Range.location := 0;
Range.length := CFStringGetLength(CFStr);
SetLength(Result, Range.length);
CFStringGetCharacters(CFStr, Range, PChar(Result));
end;
{$ENDIF}
end. |
Partager