Index: src/test/OTAppDelegate.m ================================================================== --- src/test/OTAppDelegate.m +++ src/test/OTAppDelegate.m @@ -25,10 +25,14 @@ #import "OTTestCase.h" #import "OTAssertionFailedException.h" #import "OTTestSkippedException.h" + +#ifdef OF_IOS +# include +#endif #ifdef OF_WII # define asm __asm__ # include # include @@ -92,11 +96,26 @@ + (void)initialize { if (self != [OTAppDelegate class]) return; -#if defined(OF_WII) +#if defined(OF_IOS) + CFBundleRef mainBundle = CFBundleGetMainBundle(); + CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); + UInt8 resourcesPath[PATH_MAX]; + + if (!CFURLGetFileSystemRepresentation(resourcesURL, true, resourcesPath, + PATH_MAX)) { + [OFStdErr writeLine: @"Failed to locate resources!"]; + [OFApplication terminateWithStatus: 1]; + } + + [[OFFileManager defaultManager] changeCurrentDirectoryPath: + [OFString stringWithUTF8String: (const char *)resourcesPath]]; + + CFRelease(resourcesURL); +#elif defined(OF_WII) GXRModeObj *mode; void *nextFB; VIDEO_Init(); WPAD_Init(); @@ -143,11 +162,13 @@ /* * Make sure the class is initialized. * Required for the ObjFW runtime, as otherwise * class_getSuperclass() crashes. */ +#ifdef OF_OBJFW_RUNTIME [*iter class]; +#endif /* * Don't use +[isSubclassOfClass:], as the Apple runtime * can return (presumably internal?) classes that don't * implement it, resulting in a crash. Index: tests/iOS.xcodeproj/project.pbxproj ================================================================== --- tests/iOS.xcodeproj/project.pbxproj +++ tests/iOS.xcodeproj/project.pbxproj @@ -5,10 +5,11 @@ }; objectVersion = 48; objects = { /* Begin PBXBuildFile section */ + 4B1E2CEF2B8294F200BB28B6 /* libobjfwtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B1E2CEE2B8294F200BB28B6 /* libobjfwtest.a */; }; 4B6AB9CD202BA431007BAC7D /* TestPlugin.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B6AB9CA202BA408007BAC7D /* TestPlugin.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 4BC7FD07201394F300280496 /* ObjFW.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BC7FD06201394F300280496 /* ObjFW.framework */; }; 4BC7FD092013954B00280496 /* tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BC7FD082013954B00280496 /* tests.a */; }; 4BC7FD0B2013956D00280496 /* ObjFW.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4BC7FD06201394F300280496 /* ObjFW.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 4BC7FD102013960600280496 /* testfile.txt in Resources */ = {isa = PBXBuildFile; fileRef = 4BC7FD0C2013960600280496 /* testfile.txt */; }; @@ -39,10 +40,11 @@ runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 4B1E2CEE2B8294F200BB28B6 /* libobjfwtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libobjfwtest.a; path = ../src/test/libobjfwtest.a; sourceTree = ""; }; 4B6AB9CA202BA408007BAC7D /* TestPlugin.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = TestPlugin.bundle; path = plugin/TestPlugin.bundle; sourceTree = ""; }; 4BC7FD06201394F300280496 /* ObjFW.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ObjFW.framework; path = ../src/ObjFW.framework; sourceTree = ""; }; 4BC7FD082013954B00280496 /* tests.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = tests.a; sourceTree = ""; }; 4BC7FD0C2013960600280496 /* testfile.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = testfile.txt; sourceTree = ""; }; 4BC7FD0D2013960600280496 /* testfile.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = testfile.bin; sourceTree = ""; }; @@ -55,12 +57,13 @@ /* Begin PBXFrameworksBuildPhase section */ 4BEBFB582013934E002E8710 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4BC7FD07201394F300280496 /* ObjFW.framework in Frameworks */, 4BC7FD092013954B00280496 /* tests.a in Frameworks */, + 4B1E2CEF2B8294F200BB28B6 /* libobjfwtest.a in Frameworks */, + 4BC7FD07201394F300280496 /* ObjFW.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ @@ -68,10 +71,11 @@ 4BC7FD05201394F300280496 /* Frameworks */ = { isa = PBXGroup; children = ( 4B6AB9CA202BA408007BAC7D /* TestPlugin.bundle */, 4BC7FD082013954B00280496 /* tests.a */, + 4B1E2CEE2B8294F200BB28B6 /* libobjfwtest.a */, 4BC7FD06201394F300280496 /* ObjFW.framework */, ); name = Frameworks; sourceTree = ""; }; @@ -302,10 +306,11 @@ INFOPLIST_FILE = Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)", + "$(PROJECT_DIR)/../src/test", ); OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = im.nil.objfw.tests; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; @@ -322,10 +327,11 @@ INFOPLIST_FILE = Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)", + "$(PROJECT_DIR)/../src/test", ); OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = im.nil.objfw.tests; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2";