Commit f665a1c7 authored by Evan Ramos's avatar Evan Ramos

macOS: Add osx_getdocumentsdir

Needed because GOG .pkg installers default to the Documents folder
parent 74aceda6
......@@ -20,6 +20,7 @@ char *osx_gethomedir(void);
char *osx_getsupportdir(int32_t local);
char *osx_getappdir(void);
char *osx_getapplicationsdir(int32_t local);
char *osx_getdocumentsdir(int32_t local);
#ifdef __cplusplus
}
......
......@@ -177,3 +177,21 @@ char *osx_getapplicationsdir(int32_t local)
return returnpath;
}
char *osx_getdocumentsdir(int32_t local)
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, local ? NSUserDomainMask : NSLocalDomainMask, YES);
char *returnpath = NULL;
if ([paths count] > 0)
{
const char *Cpath = [[paths objectAtIndex:0] UTF8String];
if (Cpath)
returnpath = Bstrdup(Cpath);
}
[paths release];
return returnpath;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment