Results 1 to 10 of 11

Thread: FPC + Mac file handling

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    And for those people who will search answer without using ZenGL, here the source code:
    Code:
    uses
      MacOSAll;
    //
      var
        appBundle   : CFBundleRef;
        appCFURLRef : CFURLRef;
        appCFString : CFStringRef;
        appPath     : array[ 0..8191 ] of AnsiChar;
    begin
      appBundle   := CFBundleGetMainBundle();
      appCFURLRef := CFBundleCopyBundleURL( appBundle );
      appCFString := CFURLCopyFileSystemPath( appCFURLRef, kCFURLPOSIXPathStyle );
      CFStringGetFileSystemRepresentation( appCFString, @appPath[ 0 ], 8192 );
      appWorkDir  := appPath + '/';
    But if I remember right, ParamString(0) also will return something...

  2. #2
    Quote Originally Posted by Andru View Post
    And for those people who will search answer without using ZenGL, here the source code:
    Code:
    uses
      MacOSAll;
    //
      var
        appBundle   : CFBundleRef;
        appCFURLRef : CFURLRef;
        appCFString : CFStringRef;
        appPath     : array[ 0..8191 ] of AnsiChar;
    begin
      appBundle   := CFBundleGetMainBundle();
      appCFURLRef := CFBundleCopyBundleURL( appBundle );
      appCFString := CFURLCopyFileSystemPath( appCFURLRef, kCFURLPOSIXPathStyle );
      CFStringGetFileSystemRepresentation( appCFString, @appPath[ 0 ], 8192 );
      appWorkDir  := appPath + '/';
    But if I remember right, ParamString(0) also will return something...
    Nice! Good one Andru

    cheers,
    Paul

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •