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.
To access the Application Support folder, perform the following task: Open Finder from Dock. Navigate to the Menu bar and click Go. Next, press the Option key and select Library to open the Library folder.
The Application Support folder holds files that some apps need to run. While there are a number of files you could delete here, it's best to be careful.
Swipe up from the bottom of your screen to the top. If you get All Apps , tap it. Tap the app that you want to open.
Proper way to do it in C/C++:
#include <CoreServices/CoreServices.h>
FSRef ref;
OSType folderType = kApplicationSupportFolderType;
char path[PATH_MAX];
FSFindFolder( kUserDomain, folderType, kCreateFolder, &ref );
FSRefMakePath( &ref, (UInt8*)&path, PATH_MAX );
// You now have ~/Library/Application Support stored in 'path'
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With