(iOS) Set up all the path to 'Documents' - you can access these with

iTunes File Sharing now - no need to add assets prior to deployment
This commit is contained in:
Twinaphex 2015-03-12 23:32:19 +01:00
parent 48f8f02a2f
commit 29d546e49d
2 changed files with 30 additions and 7 deletions

View File

@ -41,12 +41,34 @@ NS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetainCompat(id X)
#endif
}
static NSSearchPathDirectory NSConvertFlagsCF(unsigned flags)
{
switch (flags)
{
case CFDocumentDirectory:
return NSDocumentDirectory;
}
return 0;
}
static NSSearchPathDomainMask NSConvertDomainFlagsCF(unsigned flags)
{
switch (flags)
{
case CFUserDomainMask:
return NSUserDomainMask;
}
return 0;
}
void CFSearchPathForDirectoriesInDomains(unsigned flags,
unsigned domain_mask, unsigned expand_tilde,
char *buf, size_t sizeof_buf)
unsigned domain_mask, unsigned expand_tilde,
char *buf, size_t sizeof_buf)
{
CFTypeRef array_val = (CFTypeRef)CFBridgingRetainCompat(NSSearchPathForDirectoriesInDomains(flags, domain_mask, (BOOL)expand_tilde));
CFTypeRef array_val = (CFTypeRef)CFBridgingRetainCompat(NSSearchPathForDirectoriesInDomains(NSConvertFlagsCF(flags), NSConvertDomainFlagsCF(domain_mask), (BOOL)expand_tilde));
CFArrayRef array = array_val ? CFRetain(array_val) : NULL;
CFTypeRef path_val = (CFTypeRef)CFArrayGetValueAtIndex(array, 0);
CFStringRef path = path_val ? CFRetain(path_val) : NULL;

View File

@ -49,12 +49,13 @@ static void frontend_apple_get_environment_settings(int *argc, char *argv[],
#ifdef IOS
CFSearchPathForDirectoriesInDomains(CFDocumentDirectory, CFUserDomainMask, 1, home_dir_buf, sizeof(home_dir_buf));
RARCH_LOG("home dir: %s\n", home_dir_buf);
fill_pathname_join(g_defaults.system_dir, home_dir_buf, ".RetroArch", sizeof(g_defaults.system_dir));
fill_pathname_join(g_defaults.core_dir, bundle_path_buf, "modules", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.core_info_dir, bundle_path_buf, "info", sizeof(g_defaults.core_info_dir));
fill_pathname_join(g_defaults.shader_dir, bundle_path_buf, "shaders_glsl", sizeof(g_defaults.shader_dir));
fill_pathname_join(g_defaults.overlay_dir, bundle_path_buf, "overlays", sizeof(g_defaults.overlay_dir));
fill_pathname_join(g_defaults.core_dir, home_dir_buf, "modules", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.core_info_dir, home_dir_buf, "info", sizeof(g_defaults.core_info_dir));
fill_pathname_join(g_defaults.shader_dir, home_dir_buf, "shaders_glsl", sizeof(g_defaults.shader_dir));
fill_pathname_join(g_defaults.overlay_dir, home_dir_buf, "overlays", sizeof(g_defaults.overlay_dir));
strlcpy(g_defaults.menu_config_dir, g_defaults.system_dir, sizeof(g_defaults.menu_config_dir));
fill_pathname_join(g_defaults.config_path, g_defaults.menu_config_dir, "retroarch.cfg", sizeof(g_defaults.config_path));