@@ -24,10 +24,14 @@ #if defined(STDOUT) && (defined(OF_WINDOWS) || defined(OF_MSDOS)) # undef STDOUT # define STDOUT_SIMPLE #endif + +#ifdef OF_IOS +# include +#endif #ifdef OF_PSP # include # include # include @@ -354,10 +358,24 @@ #endif } - (void)applicationDidFinishLaunching { +#if defined(OF_IOS) && defined(OF_HAVE_FILES) + CFBundleRef mainBundle = CFBundleGetMainBundle(); + CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); + UInt8 resourcesPath[PATH_MAX]; + + if (!CFURLGetFileSystemRepresentation(resourcesURL, true, resourcesPath, + PATH_MAX)) { + [of_stderr writeString: @"Failed to locate resources!\n"]; + [OFApplication terminateWithStatus: 1]; + } + + [[OFFileManager defaultManager] changeCurrentDirectoryPath: + [OFString stringWithUTF8String: (const char*)resourcesPath]]; +#endif #if defined(OF_WII) && defined(OF_HAVE_FILES) [[OFFileManager defaultManager] changeCurrentDirectoryPath: @"/apps/objfw-tests"]; #endif @@ -413,11 +431,16 @@ [self JSONTests]; #ifdef OF_HAVE_PLUGINS [self pluginTests]; #endif -#if defined(OF_WII) +#if defined(OF_IOS) + [self outputString: [OFString stringWithFormat: @"%d tests failed!", + _fails] + inColor: NO_COLOR]; + [OFApplication terminateWithStatus: _fails]; +#elif defined(OF_WII) [self outputString: @"Press home button to exit!\n" inColor: NO_COLOR]; for (;;) { WPAD_ScanPads();