-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load ini from OS-preferred config paths #9
Comments
The current search paths (as defined in main.cpp:
For each path, it checks for How would I obtain the "Application Support" path on MacOS? I also recently realized that on Unix I should check |
(I opened this with not much testing or sleep, sorry)
I think this should use CMake GNUInstallDirs' No complaints with the rest of the list you outlined. The most modern way I've found for obtaining the Application Support path so far is by using NSSearchPathForDirectoriesInDomains in ObjC and interfacing with it from normal C/C++: dir.h const char* getApplicationSupportPath(); dir.m #include <Foundation/NSPathUtilities.h>
#include "dir.h"
const char* getApplicationSupportPath() {
NSArray *paths = NSSearchPathForDirectoriesInDomains (NSApplicationSupportDirectory, NSUserDomainMask, YES);
return [[paths objectAtIndex:0] UTF8String];
} This requires some small enable_language(OBJC)
find_library(FOUNDATION Foundation REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE ${FOUNDATION}) There are other, pure C APIs for getting that path like sysdir_start_search_path_enumeration (available since macOS 10.12) or NSStartSearchPathEnumeration (dunno when introduced, works as far back as 10.3, deprecated by the former) if you'd rather not touch ObjC, though I haven't tested them. Or you could always just hardcode that path, though iunno if there are any scenarios where this might cause problems. |
The I think I'll use the hardcoded path solution for macOS based on furnace, because I have no way to test it by myself. |
macOS:
~/Library/Application Support/vgmplay/VGMPlay.ini
(or what the other unixoids are doing)Other Unixoids (i.e. Linux, BSDs):
$XDG_CONFIG_HOME/vgmplay/VGMPlay.ini
The text was updated successfully, but these errors were encountered: