smarthaert / phoenixlib

Automatically exported from code.google.com/p/phoenixlib
0 stars 0 forks source link

../Resources does not work anymore on MacOS #121

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
../Resources does not work anymore on MacOS... 
http://www.pascalgamedevelopment.com/showthread.php?6612-Distributing-Program-wi
th-its-own-File-Structure-in-MacOS-Application-Bundle&highlight=resources

Please Change it to something like this example :

http://svn.freepascal.org/svn/lazarus/trunk/examples/trayicon/frmtest.pas

uses
 {$ifdef Windows}
  Windows;
  {$endif}
  {$IFDEF Darwin}
  {$ifdef ver2_2_0}
    FPCMacOSAll;
  {$else}
    MacOSAll;
  {$endif}                 

const
      BundleResourceFolder = '/Contents/Resources/';
var
    ContentBase : String;
{$IFDEF Darwin}
  pathRef: CFURLRef;
  pathCFStr: CFStringRef;
  pathStr: shortstring;
{$ENDIF}
begin
  ContentBase:='';
  {$IFDEF DARWIN}
  // Keep the original path to /Contents/Resources in the .app - file
  pathRef := CFBundleCopyBundleURL(CFBundleGetMainBundle());
  pathCFStr := CFURLCopyFileSystemPath(pathRef, kCFURLPOSIXPathStyle);
  CFStringGetPascalString(pathCFStr, @pathStr, 255, CFStringGetSystemEncoding());
  CFRelease(pathRef);
  CFRelease(pathCFStr);

  ContentBase := pathStr + BundleResourceFolder;

  {$ELSE}
  ContentBase:= ExtractFilePath( ParamStr(0) ) + 'Content/';
  {$ENDIF}                                        

Original issue reported on code.google.com by wagenhei...@gmail.com on 13 Jan 2011 at 3:08

GoogleCodeExporter commented 9 years ago
Here is the update demo and compiled version of ImageList demo to MacOS.

http://wagenheimer.com/temp/01_ImageList.zip

Original comment by wagenhei...@gmail.com on 13 Jan 2011 at 3:30

GoogleCodeExporter commented 9 years ago

Original comment by andreas....@gmail.com on 8 Aug 2013 at 2:11