(OSX) Move code over to platform_apple.c

This commit is contained in:
Twinaphex 2014-10-17 17:05:27 +02:00
parent f704097573
commit 0132581ebc
4 changed files with 11 additions and 10 deletions

View File

@ -133,13 +133,6 @@ static char** waiting_argv;
{ {
apple_platform = self; apple_platform = self;
char support_path_buf[PATH_MAX + 1];
CFSearchPathForDirectoriesInDomains(CFApplicationSupportDirectory, CFUserDomainMask, YES, support_path_buf, sizeof(support_path_buf));
fill_pathname_join(g_defaults.core_dir, NSBundle.mainBundle.bundlePath.UTF8String, "Contents/Resources/modules", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.menu_config_dir, support_path_buf, "RetroArch", 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));
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
[self.window setCollectionBehavior:[self.window collectionBehavior] | NSWindowCollectionBehaviorFullScreenPrimary]; [self.window setCollectionBehavior:[self.window collectionBehavior] | NSWindowCollectionBehaviorFullScreenPrimary];

View File

@ -60,6 +60,6 @@ typedef enum
} CFDomainMask; } CFDomainMask;
void CFSearchPathForDirectoriesInDomains(unsigned flags, void CFSearchPathForDirectoriesInDomains(unsigned flags,
unsigned domain_mask, BOOL expand_tilde, char *buf, size_t sizeof_buf); unsigned domain_mask, unsigned expand_tilde, char *buf, size_t sizeof_buf);
#endif #endif

View File

@ -19,11 +19,11 @@
#include "CFExtensions.h" #include "CFExtensions.h"
void CFSearchPathForDirectoriesInDomains(unsigned flags, void CFSearchPathForDirectoriesInDomains(unsigned flags,
unsigned domain_mask, BOOL expand_tilde, unsigned domain_mask, unsigned expand_tilde,
char *buf, size_t sizeof_buf) char *buf, size_t sizeof_buf)
{ {
CFArrayRef array = CFBridgingRetain(NSSearchPathForDirectoriesInDomains( CFArrayRef array = CFBridgingRetain(NSSearchPathForDirectoriesInDomains(
flags, domain_mask, expand_tilde)); flags, domain_mask, (BOOL)expand_tilde));
CFStringRef path = CFBridgingRetain(CFArrayGetValueAtIndex(array, 0)); CFStringRef path = CFBridgingRetain(CFArrayGetValueAtIndex(array, 0));
CFStringGetCString(path, buf, sizeof_buf, kCFStringEncodingUTF8); CFStringGetCString(path, buf, sizeof_buf, kCFStringEncodingUTF8);
CFRelease(path); CFRelease(path);

View File

@ -14,6 +14,7 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "../../apple/common/CFExtensions.h"
#include "../menu/menu_common.h" #include "../menu/menu_common.h"
#include "../../settings_data.h" #include "../../settings_data.h"
@ -169,6 +170,13 @@ static void frontend_apple_get_environment_settings(int *argc, char *argv[],
} }
CFRelease(home_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));
fill_pathname_join(g_defaults.core_dir, bundle_path_buf, "Contents/Resources/modules", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.menu_config_dir, support_path_buf, "RetroArch", 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));
#endif #endif
CFRelease(bundle_path); CFRelease(bundle_path);