So far I have the following external definitions: Function CFStringGetFileSystemRepresentation(myPathString : CFStringRef; buffer : ppchar; maxBufLen : CFIndex) : Boolean; cdecl; External; Function _CFStringGetFileSystemRepresentation(myPathString : CFStringRef; buffer : ppchar; maxBufLen : CFIndex) : Boolean; C; External; Function CFStringGetMaximumSizeOfFileSystemRepresentation(myPathStr2 : CFStringRef) : CFIndex; cdecl; External; Function _CFStringGetMaximumSizeOfFileSystemRepresentation(myPathStr2 : CFStringRef) : CFIndex; C; External;
Function CFBundleGetMainBundle() : CFBundleRef; cdecl; External; Function _CFBundleGetMainBundle() : CFBundleRef; C; External; and the following snippet var success : boolean = false; mainBundle : CFBundleRef; bundlePath : CFURLRef; bundlePathStr : CFStringRef; myBundlePathStr : ppchar; begin // Get the main bundle for the app mainBundle := CFBundleGetMainBundle(); bundlePath := CFBundleCopyBundleURL(mainBundle); bundlePathStr := CFURLCopyFileSystemPath (bundlePath, kCFURLPOSIXPathStyle); success := CFStringGetFileSystemRepresentation (bundlePathStr, myBundlePathStr, CFStringGetMaximumSizeOfFileSystemRepresentation(bundlePathStr)); I'm not quite sure if I am doing the 2nd arg correctly, it's supposed to be char *buffer. Does this look alright? If not, what should I be using for the myBundlePathString type? And I notice that CFStringGetFileSystemRepresentation is only available for 10.4 and newer. What do i need to do instead if wanting to deploy to 10.3.9? Thx again for all the help, sooo close! Ken G. Brown At 6:24 PM +0100 2/5/09, Jonas Maebe apparently wrote: >On 05 Feb 2009, at 17:03, Ken G. Brown wrote: > >>Thx for the quick response! >>I think I'm almost there. I seem to have a bundlePath : CFURLRef; but I don't >>quite know what to do with it. How do I convert it to something I can use in >>a Reset() to open a file? > >If you enter CFURLRef in the search box at the top right point of the page, >the first link in the search results is >http://developer.apple.com/documentation/CoreFoundation/Reference/CFBundleRef/Reference/reference.html > >The Overview section notes: > >*** >You can also obtain locations of subdirectories in a bundle represented as >CFURL objects. The CFBundleCopyExecutableURL function returns the location of >the application's executable. The functions CFBundleCopyResourceURL, >CFBundleCopySharedFrameworksURL, >CFBundleCopyPrivateFrameworksURL,CFBundleCopySharedSupportURL, and >CFBundleCopyBuiltInPlugInsURL return the location of a bundle's subdirectory >containing resources, shared frameworks, private frameworks, shared support >files, and plug-ins >*** > >Clicking on CFURLRef in the declarations of these functions redirects to >http://developer.apple.com/documentation/CoreFoundation/Reference/CFURLRef/Reference/reference.html#//apple_ref/doc/c_ref/CFURLRef > >On that page, under "Functions by Task" and then "Accessing the Parts of a >URL", there is a function called CFURLCopyFileSystemPath. This function can >return a POSIX path (kCFURLPOSIXPathStyle) in a CFStringRef. > >Clicking on CFStringRef redirects to >http://developer.apple.com/documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html#//apple_ref/doc/c_ref/CFStringRef > >There, under "Functions by Task" and then "String File System >Representations", there is a function called >CFStringGetFileSystemRepresentation, which in combination with >CFStringGetMaximumSizeOfFileSystemRepresentation can be used to obtain a >null-terminated string containing a path that can be passed to reset etc. > > >Jonas >_______________________________________________ >fpc-pascal maillist - fpc-pascal@lists.freepascal.org >http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal