Use CoreFoundation to get SearchPaths

Hello,


i want to commit to a C-Code-Project on github to make it work correctly on macOS.

Under Objective-C there is the function NSSearchPathForDirectoriesInDomains, but i need to stay with C code.

Therefore i need to get paths like ApplicationSupport and Folder of User.

For the Bundle there is code like


char path[1024];
  CFBundleRef main_bundle = CFBundleGetMainBundle(); assert(main_bundle);
  CFURLRef main_bundle_URL = CFBundleCopyBundleURL(main_bundle); assert(main_bundle_URL);
  CFStringRef cf_string_ref = CFURLCopyFileSystemPath( main_bundle_URL, kCFURLPOSIXPathStyle); assert(cf_string_ref);
  CFStringGetCString(cf_string_ref, path, 1024, kCFStringEncodingASCII);
  CFRelease(main_bundle_URL);
  CFRelease(cf_string_ref);


How can i get AppSupportDir, there is no info.plist file.

I'm disapponted on zero answers.


#include <Foundation.h>


[NSSearchPathForDirectoriesInDomains(

NSApplicationSupportDirectory
, NSUserDomainMask, YES) objectAtIndex:0];


is it possible to bridge that to CoreFoundation?

Did you have a look here :


h ttps://developer.apple.com/library/content/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/ManagingFIlesandDirectories/ManagingFIlesandDirectories.html

Use CoreFoundation to get SearchPaths
 
 
Q