Created
January 24, 2019 09:10
-
-
Save tek-nishi/c511ea4523273bc221e75d9641137b12 to your computer and use it in GitHub Desktop.
Get macOS Application Support Folder from SDK.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::string getDocumentFolder() | |
{ | |
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); | |
if ([paths count] == 0) | |
{ | |
// Error. | |
return std::string(""); | |
} | |
NSString* applicationSupportDirectory = [NSString stringWithFormat:@"%@/%@", | |
[paths objectAtIndex:0], | |
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]]; | |
std::string path = [applicationSupportDirectory UTF8String]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment