You've already forked lazarus-ccr
fpchess: Implements obtaining the resources directory, allows running from the Bundle in Mac OS X
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1553 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -22,11 +22,41 @@ var
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
{$ifdef Darwin}
|
||||||
|
uses
|
||||||
|
MacOSAll;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
const
|
||||||
|
BundleResourcesDirectory = '/Contents/Resources/';
|
||||||
|
|
||||||
{ TChessConfig }
|
{ TChessConfig }
|
||||||
|
|
||||||
function TChessConfig.GetResourcesDir: string;
|
function TChessConfig.GetResourcesDir: string;
|
||||||
|
{$ifdef Darwin}
|
||||||
|
var
|
||||||
|
pathRef: CFURLRef;
|
||||||
|
pathCFStr: CFStringRef;
|
||||||
|
pathStr: shortstring;
|
||||||
|
{$endif}
|
||||||
begin
|
begin
|
||||||
|
{$ifdef UNIX}
|
||||||
|
{$ifdef Darwin}
|
||||||
|
pathRef := CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||||
|
pathCFStr := CFURLCopyFileSystemPath(pathRef, kCFURLPOSIXPathStyle);
|
||||||
|
CFStringGetPascalString(pathCFStr, @pathStr, 255, CFStringGetSystemEncoding());
|
||||||
|
CFRelease(pathRef);
|
||||||
|
CFRelease(pathCFStr);
|
||||||
|
|
||||||
|
Result := pathStr + BundleResourcesDirectory;
|
||||||
|
{$else}
|
||||||
|
Result := '';
|
||||||
|
{$endif}
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
{$ifdef Windows}
|
||||||
|
Result := ExtractFilePath(Application.EXEName);
|
||||||
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TChessConfig.GetCurrentSkinDir: string;
|
function TChessConfig.GetCurrentSkinDir: string;
|
||||||
|
Reference in New Issue
Block a user