I've written a GTKmm application and I'm trying to create some OS X enhancements. I'd like to store my configuration file in the Application Support/myApp folder, however, I can't figure out the proper way to locate this folder.
I've tried looking through the Core Foundation library (that I'm using to get my myApp.app path) but I can't find anything.
Proper way to do it in C/C++:
Naturally, those are very old APIs and their use is no longer recommended by Apple. Despite that it gets the job done if you want to avoid Objective-C completely in your codebase.
It appears that the function to use for this is NSSearchPathForDirectoriesInDomains (or some other functions listed on the same page) with
NSApplicationSupportDirectory
as the argument.In BSD Unix, included in OS-X, you can get the home directory of the user running the program with this:
Using this, you can then construct the path using this in place of ~