Merge pull request #1188 from jeapostrophe/master

Fixing the way that RA gets the home directory due to iOS8 change
This commit is contained in:
Twinaphex 2014-10-24 19:23:54 +02:00
commit 9c872680c9
3 changed files with 8 additions and 18 deletions

View File

@ -22,8 +22,7 @@ void CFSearchPathForDirectoriesInDomains(unsigned flags,
unsigned domain_mask, unsigned expand_tilde,
char *buf, size_t sizeof_buf)
{
CFTypeRef array_val = (CFTypeRef)NSSearchPathForDirectoriesInDomains(
flags, domain_mask, (BOOL)expand_tilde);
CFTypeRef array_val = (CFTypeRef)CFBridgingRetain(NSSearchPathForDirectoriesInDomains(flags, 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

@ -21,6 +21,7 @@
50CCC828185E0E7D001F5BC8 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50CCC827185E0E7D001F5BC8 /* CoreLocation.framework */; };
50D00E8E19D117C400EBA71E /* cc_resampler_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 50D00E8D19D117C400EBA71E /* cc_resampler_neon.S */; };
50E7189F184B88AA001956CE /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50E7189E184B88AA001956CE /* CoreVideo.framework */; };
6949E72319FABADC00CC7F42 /* CFExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 6949E72219FABADC00CC7F42 /* CFExtensions.m */; };
696012F219F3389A006A1088 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 696012F119F3389A006A1088 /* CoreText.framework */; };
83D632DF19ECFCC4009E3161 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83D632D819ECFCC4009E3161 /* Default-568h@2x.png */; };
83D632E019ECFCC4009E3161 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 83D632D919ECFCC4009E3161 /* Default.png */; };
@ -57,6 +58,7 @@
50CCC827185E0E7D001F5BC8 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
50D00E8D19D117C400EBA71E /* cc_resampler_neon.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = cc_resampler_neon.S; path = ../../audio/resamplers/cc_resampler_neon.S; sourceTree = "<group>"; };
50E7189E184B88AA001956CE /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
6949E72219FABADC00CC7F42 /* CFExtensions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CFExtensions.m; path = ../common/CFExtensions.m; sourceTree = "<group>"; };
696012F119F3389A006A1088 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
83D632D819ECFCC4009E3161 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
83D632D919ECFCC4009E3161 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
@ -137,6 +139,7 @@
96AFAE1A16C1D4EA009DE44C = {
isa = PBXGroup;
children = (
6949E72219FABADC00CC7F42 /* CFExtensions.m */,
83D632D719ECFCC4009E3161 /* Assets */,
50D00E8D19D117C400EBA71E /* cc_resampler_neon.S */,
501232C6192E5F940063A359 /* ios */,
@ -314,6 +317,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6949E72319FABADC00CC7F42 /* CFExtensions.m in Sources */,
50D00E8E19D117C400EBA71E /* cc_resampler_neon.S in Sources */,
5073C58B196C0BA40026E146 /* utility.m in Sources */,
501232DA192E606D0063A359 /* menu.m in Sources */,
@ -505,6 +509,7 @@
"-D_LZMA_UINT32_IS_ULONG",
);
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
VALID_ARCHS = "armv7 armv7s";
WRAPPER_EXTENSION = app;
};
@ -597,7 +602,6 @@
"-D_LZMA_UINT32_IS_ULONG",
);
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
VALID_ARCHS = "armv7 armv7s";
WRAPPER_EXTENSION = app;

View File

@ -134,19 +134,8 @@ static void frontend_apple_get_environment_settings(int *argc, char *argv[],
(void)home_dir_buf;
#ifdef IOS
CFURLRef home_dir = CFCopyHomeDirectoryURL();
int doc_len = 10; /* Length of "/Documents" */
int pre_len = 7; /* Length of "file://" */
int dd_len = CFURLGetBytes(home_dir, NULL, 0 );
UInt8 *dd_bs = (UInt8 *)(malloc(dd_len - pre_len + doc_len));
CFURLGetFileSystemRepresentation(home_dir, true, dd_bs, dd_len - pre_len);
/* We subtract another 1 to get the NUL */
strlcpy((char *)(dd_bs + dd_len - pre_len - 1), "/Documents", doc_len + 1);
CFStringRef home_dir_ref = CFURLCopyPath(home_dir);
CFStringGetCString(home_dir_ref, home_dir_buf, sizeof(home_dir_buf), kCFStringEncodingUTF8);
CFSearchPathForDirectoriesInDomains(CFDocumentDirectory, CFUserDomainMask, 1, home_dir_buf, sizeof(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));
@ -167,8 +156,6 @@ static void frontend_apple_get_environment_settings(int *argc, char *argv[],
if (access(g_defaults.system_dir, 0755) != 0)
RARCH_ERR("Failed to create or access system directory: %s.\n", g_defaults.system_dir);
}
CFRelease(home_dir);
#elif defined(OSX)
char support_path_buf[PATH_MAX + 1];
CFSearchPathForDirectoriesInDomains(CFApplicationSupportDirectory, CFUserDomainMask, 1, support_path_buf, sizeof(support_path_buf));