ios: Include overlays in built app bundles.

Fix crash if the RetroArch.app/modules directory is missing or has no .dylib files inside.
This commit is contained in:
meancoot 2013-02-10 15:11:21 -05:00
parent 12b079dd61
commit c989256d43
2 changed files with 25 additions and 2 deletions

View File

@ -18,6 +18,7 @@
96297A1D16C6D20900E6DCE0 /* settings_list.m in Sources */ = {isa = PBXBuildFile; fileRef = 96297A1C16C6D20900E6DCE0 /* settings_list.m */; };
96297A2416C818FF00E6DCE0 /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 96297A2216C818FF00E6DCE0 /* Icon-72.png */; };
96297A2516C818FF00E6DCE0 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 96297A2316C818FF00E6DCE0 /* Icon.png */; };
96297A2716C82FF100E6DCE0 /* overlays in Resources */ = {isa = PBXBuildFile; fileRef = 96297A2616C82FF100E6DCE0 /* overlays */; };
96AFAE2A16C1D4EA009DE44C /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96AFAE2916C1D4EA009DE44C /* UIKit.framework */; };
96AFAE2C16C1D4EA009DE44C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96AFAE2B16C1D4EA009DE44C /* Foundation.framework */; };
96AFAE2E16C1D4EA009DE44C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96AFAE2D16C1D4EA009DE44C /* CoreGraphics.framework */; };
@ -95,6 +96,7 @@
96297A1C16C6D20900E6DCE0 /* settings_list.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = settings_list.m; sourceTree = "<group>"; };
96297A2216C818FF00E6DCE0 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-72.png"; path = "RetroArch/Icon-72.png"; sourceTree = "<group>"; };
96297A2316C818FF00E6DCE0 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon.png; path = RetroArch/Icon.png; sourceTree = "<group>"; };
96297A2616C82FF100E6DCE0 /* overlays */ = {isa = PBXFileReference; lastKnownFileType = folder; name = overlays; path = ../media/overlays; sourceTree = "<group>"; };
96AFAE2516C1D4EA009DE44C /* RetroArch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RetroArch.app; sourceTree = BUILT_PRODUCTS_DIR; };
96AFAE2916C1D4EA009DE44C /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
96AFAE2B16C1D4EA009DE44C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@ -300,6 +302,7 @@
96AFAE1A16C1D4EA009DE44C = {
isa = PBXGroup;
children = (
96297A2616C82FF100E6DCE0 /* overlays */,
96297A2216C818FF00E6DCE0 /* Icon-72.png */,
96297A2316C818FF00E6DCE0 /* Icon.png */,
962979F416C43B9500E6DCE0 /* ic_dir.png */,
@ -722,6 +725,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
96297A2716C82FF100E6DCE0 /* overlays in Resources */,
96AFAE3816C1D4EA009DE44C /* InfoPlist.strings in Resources */,
96AFAE4016C1D4EA009DE44C /* Default.png in Resources */,
96AFAE4216C1D4EA009DE44C /* Default@2x.png in Resources */,

View File

@ -6,6 +6,16 @@
// Copyright (c) 2013 RetroArch. All rights reserved.
//
static void display_error_alert(NSString* message)
{
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"RetroArch"
message:message
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
@implementation module_list
{
NSArray* modules;
@ -21,8 +31,17 @@
@"modules"];
modules = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:module_dir error:nil];
modules = [module_dir stringsByAppendingPaths:modules];
modules = [modules pathsMatchingExtensions:[NSArray arrayWithObject:@"dylib"]];
if (modules != nil)
{
modules = [module_dir stringsByAppendingPaths:modules];
modules = [modules pathsMatchingExtensions:[NSArray arrayWithObject:@"dylib"]];
}
if (modules == nil || [modules count] == 0)
{
display_error_alert(@"No libretro cores were found.");
}
[self setTitle:@"Choose Emulator"];
self.navigationItem.rightBarButtonItem = [RetroArch_iOS get].settings_button;