Refactored automated rwops tests so read and write directories can be more easily customized.
authorEric Wing <ewing . public |-at-| gmail . com>
Sun, 09 May 2010 06:58:30 -0700
changeset 4451033c455bbe99
parent 4450 abd88bbaea2a
child 4452 4011619aab7e
Refactored automated rwops tests so read and write directories can be more easily customized.

The refactored tests were written in recognition that Mac and iPhone current working directories are usually not going to work. Resource directories are in bundles and write directories are restricted to certain areas. In theory, other platforms may have this problem too, hence the refactoring.

Also updated the Xcode iPhone project to use 3.2 as the Base SDK, but 3.1 as the Deployment SDK (for iPhone/iPad compatibility.)
Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj
test/automated/Makefile
test/automated/rwops/TestSupportRWops.h
test/automated/rwops/TestSupportRWops_Cocoa.m
test/automated/rwops/TestSupportRWops_Generic.c
test/automated/rwops/Test_rwopsbundlesupport.h
test/automated/rwops/Test_rwopsbundlesupport.m
test/automated/rwops/rwops.c
     1.1 --- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Sat May 08 08:23:46 2010 -0700
     1.2 +++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Sun May 09 06:58:30 2010 -0700
     1.3 @@ -34,6 +34,7 @@
     1.4  /* End PBXAggregateTarget section */
     1.5  
     1.6  /* Begin PBXBuildFile section */
     1.7 +		001E39A71196EE6F00A3F5B8 /* TestSupportRWops_Cocoa.m in Sources */ = {isa = PBXBuildFile; fileRef = 001E39A51196EE6F00A3F5B8 /* TestSupportRWops_Cocoa.m */; };
     1.8  		006E9852119550FB001DE610 /* audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9831119550FB001DE610 /* audio.c */; };
     1.9  		006E9853119550FB001DE610 /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9834119550FB001DE610 /* common.c */; };
    1.10  		006E9859119550FB001DE610 /* platform.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E983D119550FB001DE610 /* platform.c */; };
    1.11 @@ -42,7 +43,6 @@
    1.12  		006E985C119550FB001DE610 /* render.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9844119550FB001DE610 /* render.c */; };
    1.13  		006E985D119550FB001DE610 /* read in Copy rwops */ = {isa = PBXBuildFile; fileRef = 006E9847119550FB001DE610 /* read */; };
    1.14  		006E985E119550FB001DE610 /* rwops.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9848119550FB001DE610 /* rwops.c */; };
    1.15 -		006E985F119550FB001DE610 /* Test_rwopsbundlesupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 006E984B119550FB001DE610 /* Test_rwopsbundlesupport.m */; };
    1.16  		006E9860119550FB001DE610 /* SDL_at.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E984C119550FB001DE610 /* SDL_at.c */; };
    1.17  		006E9861119550FB001DE610 /* surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E984F119550FB001DE610 /* surface.c */; };
    1.18  		006E9862119550FB001DE610 /* testsdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9851119550FB001DE610 /* testsdl.c */; };
    1.19 @@ -264,6 +264,8 @@
    1.20  /* End PBXCopyFilesBuildPhase section */
    1.21  
    1.22  /* Begin PBXFileReference section */
    1.23 +		001E39A51196EE6F00A3F5B8 /* TestSupportRWops_Cocoa.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestSupportRWops_Cocoa.m; sourceTree = "<group>"; };
    1.24 +		001E39A61196EE6F00A3F5B8 /* TestSupportRWops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestSupportRWops.h; sourceTree = "<group>"; };
    1.25  		006E982211955059001DE610 /* testsdl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testsdl.app; sourceTree = BUILT_PRODUCTS_DIR; };
    1.26  		006E982411955059001DE610 /* testsdl-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "testsdl-Info.plist"; sourceTree = "<group>"; };
    1.27  		006E9831119550FB001DE610 /* audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = audio.c; sourceTree = "<group>"; };
    1.28 @@ -286,8 +288,6 @@
    1.29  		006E9847119550FB001DE610 /* read */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = read; sourceTree = "<group>"; };
    1.30  		006E9848119550FB001DE610 /* rwops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rwops.c; sourceTree = "<group>"; };
    1.31  		006E9849119550FB001DE610 /* rwops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rwops.h; sourceTree = "<group>"; };
    1.32 -		006E984A119550FB001DE610 /* Test_rwopsbundlesupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Test_rwopsbundlesupport.h; sourceTree = "<group>"; };
    1.33 -		006E984B119550FB001DE610 /* Test_rwopsbundlesupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Test_rwopsbundlesupport.m; sourceTree = "<group>"; };
    1.34  		006E984C119550FB001DE610 /* SDL_at.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_at.c; path = ../../test/automated/SDL_at.c; sourceTree = SOURCE_ROOT; };
    1.35  		006E984D119550FB001DE610 /* SDL_at.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_at.h; path = ../../test/automated/SDL_at.h; sourceTree = SOURCE_ROOT; };
    1.36  		006E984F119550FB001DE610 /* surface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = surface.c; sourceTree = "<group>"; };
    1.37 @@ -609,11 +609,11 @@
    1.38  		006E9846119550FB001DE610 /* rwops */ = {
    1.39  			isa = PBXGroup;
    1.40  			children = (
    1.41 +				001E39A51196EE6F00A3F5B8 /* TestSupportRWops_Cocoa.m */,
    1.42 +				001E39A61196EE6F00A3F5B8 /* TestSupportRWops.h */,
    1.43  				006E9847119550FB001DE610 /* read */,
    1.44  				006E9848119550FB001DE610 /* rwops.c */,
    1.45  				006E9849119550FB001DE610 /* rwops.h */,
    1.46 -				006E984A119550FB001DE610 /* Test_rwopsbundlesupport.h */,
    1.47 -				006E984B119550FB001DE610 /* Test_rwopsbundlesupport.m */,
    1.48  			);
    1.49  			name = rwops;
    1.50  			path = ../../test/automated/rwops;
    1.51 @@ -694,10 +694,10 @@
    1.52  		29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
    1.53  			isa = PBXGroup;
    1.54  			children = (
    1.55 -				006E982F119550E4001DE610 /* TestResources */,
    1.56 -				006E982E119550D8001DE610 /* AutomatedTests */,
    1.57  				FD99B8BC0DD52E5C00FB1D6B /* Public Headers */,
    1.58  				FD99B8BD0DD52E6D00FB1D6B /* Library Source */,
    1.59 +				006E982E119550D8001DE610 /* AutomatedTests */,
    1.60 +				006E982F119550E4001DE610 /* TestResources */,
    1.61  				29B97323FDCFA39411CA2CEA /* Frameworks */,
    1.62  				19C28FACFE9D520D11CA2CBB /* Products */,
    1.63  				006E982411955059001DE610 /* testsdl-Info.plist */,
    1.64 @@ -1313,10 +1313,10 @@
    1.65  				006E985B119550FB001DE610 /* rect.c in Sources */,
    1.66  				006E985C119550FB001DE610 /* render.c in Sources */,
    1.67  				006E985E119550FB001DE610 /* rwops.c in Sources */,
    1.68 -				006E985F119550FB001DE610 /* Test_rwopsbundlesupport.m in Sources */,
    1.69  				006E9860119550FB001DE610 /* SDL_at.c in Sources */,
    1.70  				006E9861119550FB001DE610 /* surface.c in Sources */,
    1.71  				006E9862119550FB001DE610 /* testsdl.c in Sources */,
    1.72 +				001E39A71196EE6F00A3F5B8 /* TestSupportRWops_Cocoa.m in Sources */,
    1.73  			);
    1.74  			runOnlyForDeploymentPostprocessing = 0;
    1.75  		};
    1.76 @@ -1505,15 +1505,15 @@
    1.77  			isa = XCBuildConfiguration;
    1.78  			buildSettings = {
    1.79  				ALWAYS_SEARCH_USER_PATHS = NO;
    1.80 -				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
    1.81  				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
    1.82  				GCC_C_LANGUAGE_STANDARD = c99;
    1.83  				GCC_DEBUGGING_SYMBOLS = full;
    1.84  				GCC_WARN_ABOUT_RETURN_TYPE = YES;
    1.85  				GCC_WARN_UNUSED_VARIABLE = NO;
    1.86 +				IPHONEOS_DEPLOYMENT_TARGET = 3.1;
    1.87  				ONLY_ACTIVE_ARCH = NO;
    1.88  				PREBINDING = NO;
    1.89 -				SDKROOT = iphoneos3.1.2;
    1.90 +				SDKROOT = iphoneos3.2;
    1.91  				TARGETED_DEVICE_FAMILY = "1,2";
    1.92  			};
    1.93  			name = Debug;
    1.94 @@ -1522,13 +1522,14 @@
    1.95  			isa = XCBuildConfiguration;
    1.96  			buildSettings = {
    1.97  				ALWAYS_SEARCH_USER_PATHS = NO;
    1.98 -				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
    1.99 +				ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
   1.100  				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
   1.101  				GCC_C_LANGUAGE_STANDARD = c99;
   1.102  				GCC_WARN_ABOUT_RETURN_TYPE = YES;
   1.103  				GCC_WARN_UNUSED_VARIABLE = NO;
   1.104 +				IPHONEOS_DEPLOYMENT_TARGET = 3.1;
   1.105  				PREBINDING = NO;
   1.106 -				SDKROOT = iphoneos3.1.2;
   1.107 +				SDKROOT = iphoneos3.2;
   1.108  				TARGETED_DEVICE_FAMILY = "1,2";
   1.109  			};
   1.110  			name = Release;
   1.111 @@ -1537,7 +1538,6 @@
   1.112  			isa = XCBuildConfiguration;
   1.113  			buildSettings = {
   1.114  				ALWAYS_SEARCH_USER_PATHS = NO;
   1.115 -				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
   1.116  				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
   1.117  				COPY_PHASE_STRIP = NO;
   1.118  				DEPLOYMENT_LOCATION = NO;
   1.119 @@ -1553,7 +1553,6 @@
   1.120  			isa = XCBuildConfiguration;
   1.121  			buildSettings = {
   1.122  				ALWAYS_SEARCH_USER_PATHS = NO;
   1.123 -				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
   1.124  				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
   1.125  				COPY_PHASE_STRIP = YES;
   1.126  				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
     2.1 --- a/test/automated/Makefile	Sat May 08 08:23:46 2010 -0700
     2.2 +++ b/test/automated/Makefile	Sun May 09 06:58:30 2010 -0700
     2.3 @@ -10,6 +10,7 @@
     2.4  SRC         	:= testsdl.c \
     2.5  						platform/platform.c \
     2.6  						rwops/rwops.c \
     2.7 +						rwops/TestSupportRWops.c \
     2.8  						rect/rect.c \
     2.9  						surface/surface.c \
    2.10  						render/render.c \
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/test/automated/rwops/TestSupportRWops.h	Sun May 09 06:58:30 2010 -0700
     3.3 @@ -0,0 +1,14 @@
     3.4 +
     3.5 +#include <stdio.h>
     3.6 +#include "SDL.h"
     3.7 +
     3.8 +#ifndef TestSupportRWops_h
     3.9 +#define TestSupportRWops_h
    3.10 +
    3.11 +FILE* TestSupportRWops_OpenFPFromReadDir(const char *file, const char *mode);
    3.12 +FILE* TestSupportRWops_OpenFPFromWriteDir(const char *file, const char *mode);
    3.13 +SDL_RWops* TestSupportRWops_OpenRWopsFromReadDir(const char *file, const char *mode);
    3.14 +SDL_RWops* TestSupportRWops_OpenRWopsFromWriteDir(const char *file, const char *mode);
    3.15 +
    3.16 +
    3.17 +#endif
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/test/automated/rwops/TestSupportRWops_Cocoa.m	Sun May 09 06:58:30 2010 -0700
     4.3 @@ -0,0 +1,89 @@
     4.4 +#import "TestSupportRWops.h"
     4.5 +#import <Foundation/Foundation.h>
     4.6 +#include "SDL.h"
     4.7 +
     4.8 +/* For proper OS X applications, the resources are contained inside the application bundle.
     4.9 + So the strategy is to first check the application bundle for the file, then fallback to the current working directory.
    4.10 + Note: One additional corner-case is if the resource is in a framework's resource bundle instead of the app.
    4.11 + We might want to use bundle identifiers, e.g. org.libsdl.sdl to get the bundle for the framework,
    4.12 + but we would somehow need to know what the bundle identifiers we need to search are.
    4.13 + Conversely, write directories are usually not in the bundles. This implementation uses NSTemporaryDirectory,
    4.14 + but consider Preferences, Application Support, Documents, etc.
    4.15 + Also, note the bundle layouts are different for iPhone and Mac.
    4.16 +*/
    4.17 +
    4.18 +const char* RWOPS_READ = "rwops/read";
    4.19 +const char* RWOPS_WRITE = "write";
    4.20 +
    4.21 +
    4.22 +FILE* TestSupportRWops_OpenFPFromReadDir(const char *file, const char *mode)
    4.23 +{
    4.24 +    FILE* fp = NULL;
    4.25 +
    4.26 +	// If the file mode is writable, skip all the bundle stuff because generally the bundle is read-only.
    4.27 +	if(strcmp("r", mode) && strcmp("rb", mode))
    4.28 +	{
    4.29 +		return fopen(file, mode);
    4.30 +	}
    4.31 +	
    4.32 +	NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
    4.33 +
    4.34 +
    4.35 +	NSFileManager* file_manager = [NSFileManager defaultManager];
    4.36 +	NSString* resource_path = [[NSBundle mainBundle] resourcePath];
    4.37 +
    4.38 +	NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
    4.39 +
    4.40 +	NSString* full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component];
    4.41 +	if([file_manager fileExistsAtPath:full_path_with_file_to_try])
    4.42 +	{
    4.43 +		fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
    4.44 +	}
    4.45 +	else
    4.46 +	{
    4.47 +		fp = fopen(file, mode);
    4.48 +	}
    4.49 +
    4.50 +	[autorelease_pool drain];
    4.51 +
    4.52 +	return fp;
    4.53 +}
    4.54 +
    4.55 +FILE* TestSupportRWops_OpenFPFromWriteDir(const char *file, const char *mode)
    4.56 +{
    4.57 +    FILE* fp = NULL;
    4.58 +	
    4.59 +	NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
    4.60 +	
    4.61 +	NSFileManager* file_manager = [NSFileManager defaultManager];
    4.62 +	NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
    4.63 +	NSString* full_path_with_file_to_try = [NSTemporaryDirectory() stringByAppendingPathComponent:ns_string_file_component];
    4.64 +
    4.65 +	fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
    4.66 +	
    4.67 +	[autorelease_pool drain];
    4.68 +	
    4.69 +	return fp;
    4.70 +}
    4.71 +
    4.72 +SDL_RWops* TestSupportRWops_OpenRWopsFromReadDir(const char *file, const char *mode)
    4.73 +{
    4.74 +	return SDL_RWFromFile(file, mode);
    4.75 +}
    4.76 +
    4.77 +SDL_RWops* TestSupportRWops_OpenRWopsFromWriteDir(const char *file, const char *mode)
    4.78 +{
    4.79 +	SDL_RWops* rw = NULL;
    4.80 +
    4.81 +	NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
    4.82 +	
    4.83 +	NSFileManager* file_manager = [NSFileManager defaultManager];
    4.84 +	NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
    4.85 +	NSString* full_path_with_file_to_try = [NSTemporaryDirectory() stringByAppendingPathComponent:ns_string_file_component];
    4.86 +	
    4.87 +	rw = SDL_RWFromFile( [full_path_with_file_to_try fileSystemRepresentation], mode );
    4.88 +
    4.89 +	[autorelease_pool drain];
    4.90 +	return rw;
    4.91 +}
    4.92 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/test/automated/rwops/TestSupportRWops_Generic.c	Sun May 09 06:58:30 2010 -0700
     5.3 @@ -0,0 +1,28 @@
     5.4 +/* Generic implementation for file opening routines.
     5.5 +* Customizations for specific platforms should go in alternative files.
     5.6 +*/
     5.7 +#include <stdio.h>
     5.8 +#include "SDL.h"
     5.9 +
    5.10 +const char* RWOPS_READ = "rwops/read";
    5.11 +const char* RWOPS_WRITE = "rwops/write";
    5.12 +
    5.13 +FILE* TestSupportRWops_OpenFPFromReadDir(const char *file, const char *mode)
    5.14 +{
    5.15 +	return fopen(file, mode);
    5.16 +}
    5.17 +
    5.18 +FILE* TestSupportRWops_OpenFPFromWriteDir(const char *file, const char *mode)
    5.19 +{
    5.20 +	return fopen(file, mode);
    5.21 +}
    5.22 +
    5.23 +SDL_RWops* TestSupportRWops_OpenRWopsFromReadDir(const char *file, const char *mode)
    5.24 +{
    5.25 +	return SDL_RWFromFile(file, mode);
    5.26 +}
    5.27 +
    5.28 +SDL_RWops* TestSupportRWops_OpenRWopsFromWriteDir(const char *file, const char *mode)
    5.29 +{
    5.30 +	return SDL_RWFromFile(file, mode);
    5.31 +}
     6.1 --- a/test/automated/rwops/Test_rwopsbundlesupport.h	Sat May 08 08:23:46 2010 -0700
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,11 +0,0 @@
     6.4 -#ifdef __APPLE__
     6.5 -
     6.6 -#include <stdio.h>
     6.7 -
     6.8 -#ifndef SDL_rwopsbundlesupport_h
     6.9 -#define SDL_rwopsbundlesupport_h
    6.10 -FILE* Test_OpenFPFromBundleOrFallback(const char *file, const char *mode);
    6.11 -FILE* Test_OpenFPFromTemporaryDir(const char *file, const char *mode);
    6.12 -
    6.13 -#endif
    6.14 -#endif
     7.1 --- a/test/automated/rwops/Test_rwopsbundlesupport.m	Sat May 08 08:23:46 2010 -0700
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,62 +0,0 @@
     7.4 -#ifdef __APPLE__
     7.5 -#import <Foundation/Foundation.h>
     7.6 -
     7.7 -/* For proper OS X applications, the resources are contained inside the application bundle.
     7.8 - So the strategy is to first check the application bundle for the file, then fallback to the current working directory.
     7.9 - Note: One additional corner-case is if the resource is in a framework's resource bundle instead of the app.
    7.10 - We might want to use bundle identifiers, e.g. org.libsdl.sdl to get the bundle for the framework,
    7.11 - but we would somehow need to know what the bundle identifiers we need to search are.
    7.12 - Also, note the bundle layouts are different for iPhone and Mac.
    7.13 -*/
    7.14 -FILE* Test_OpenFPFromBundleOrFallback(const char *file, const char *mode)
    7.15 -{
    7.16 -    FILE* fp = NULL;
    7.17 -
    7.18 -	// If the file mode is writable, skip all the bundle stuff because generally the bundle is read-only.
    7.19 -	if(strcmp("r", mode) && strcmp("rb", mode))
    7.20 -	{
    7.21 -		return fopen(file, mode);
    7.22 -	}
    7.23 -	
    7.24 -	NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
    7.25 -
    7.26 -
    7.27 -	NSFileManager* file_manager = [NSFileManager defaultManager];
    7.28 -	NSString* resource_path = [[NSBundle mainBundle] resourcePath];
    7.29 -
    7.30 -	NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
    7.31 -
    7.32 -	NSString* full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component];
    7.33 -	if([file_manager fileExistsAtPath:full_path_with_file_to_try])
    7.34 -	{
    7.35 -		fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
    7.36 -	}
    7.37 -	else
    7.38 -	{
    7.39 -		fp = fopen(file, mode);
    7.40 -	}
    7.41 -
    7.42 -	[autorelease_pool drain];
    7.43 -
    7.44 -	return fp;
    7.45 -}
    7.46 -
    7.47 -FILE* Test_OpenFPFromTemporaryDir(const char *file, const char *mode)
    7.48 -{
    7.49 -    FILE* fp = NULL;
    7.50 -	
    7.51 -	NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
    7.52 -	
    7.53 -	
    7.54 -	NSFileManager* file_manager = [NSFileManager defaultManager];
    7.55 -	
    7.56 -	NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
    7.57 -	
    7.58 -	NSString* full_path_with_file_to_try = [NSTemporaryDirectory() stringByAppendingPathComponent:ns_string_file_component];
    7.59 -	fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
    7.60 -	
    7.61 -	[autorelease_pool drain];
    7.62 -	
    7.63 -	return fp;
    7.64 -}
    7.65 -#endif
     8.1 --- a/test/automated/rwops/rwops.c	Sat May 08 08:23:46 2010 -0700
     8.2 +++ b/test/automated/rwops/rwops.c	Sun May 09 06:58:30 2010 -0700
     8.3 @@ -9,17 +9,11 @@
     8.4  
     8.5  #include "SDL.h"
     8.6  #include "../SDL_at.h"
     8.7 -#if __APPLE__
     8.8 -#include "Test_rwopsbundlesupport.h"
     8.9 -#endif
    8.10 +#include "TestSupportRWops.h"
    8.11  
    8.12 -#define RWOPS_READ      "rwops/read"
    8.13 -
    8.14 -#if __APPLE__
    8.15 -#define RWOPS_WRITE		"write"
    8.16 -#else
    8.17 -#define RWOPS_WRITE     "rwops/write"
    8.18 -#endif
    8.19 +/* Defined in TestSupportRWops implementation to allow flexibility. */
    8.20 +extern const char* RWOPS_READ;
    8.21 +extern const char* RWOPS_WRITE;
    8.22  
    8.23  static const char hello_world[] = "Hello World!";
    8.24  
    8.25 @@ -193,16 +187,16 @@
    8.26     SDL_ATbegin( "SDL_RWFromFile" );
    8.27  
    8.28     /* Read test. */
    8.29 -   rw = SDL_RWFromFile( RWOPS_READ, "r" );
    8.30 -   if (SDL_ATassert( "Opening memory with SDL_RWFromFile '"RWOPS_READ"'", rw != NULL ))
    8.31 +   rw = TestSupportRWops_OpenRWopsFromReadDir( RWOPS_READ, "r" );
    8.32 +   if (SDL_ATassert( "Opening memory with SDL_RWFromFile RWOPS_READ", rw != NULL ))
    8.33        return;
    8.34     if (rwops_testGeneric( rw, 0 ))
    8.35        return;
    8.36     SDL_FreeRW( rw );
    8.37  
    8.38     /* Write test. */
    8.39 -   rw = SDL_RWFromFile( RWOPS_WRITE, "w+" );
    8.40 -   if (SDL_ATassert( "Opening memory with SDL_RWFromFile '"RWOPS_WRITE"'", rw != NULL ))
    8.41 +   rw = TestSupportRWops_OpenRWopsFromWriteDir( RWOPS_WRITE, "w+" );
    8.42 +   if (SDL_ATassert( "Opening memory with SDL_RWFromFile RWOPS_WRITE", rw != NULL ))
    8.43        return;
    8.44     if (rwops_testGeneric( rw, 1 ))
    8.45        return;
    8.46 @@ -226,12 +220,8 @@
    8.47     SDL_ATbegin( "SDL_RWFromFP" );
    8.48  
    8.49     /* Run read tests. */
    8.50 -#if __APPLE__
    8.51 -	fp = Test_OpenFPFromBundleOrFallback( RWOPS_READ, "r" );
    8.52 -#else
    8.53 -   fp = fopen( RWOPS_READ, "r" );
    8.54 -#endif
    8.55 -   if (SDL_ATassert( "Failed to open file '"RWOPS_READ"'", fp != NULL))
    8.56 +   fp = TestSupportRWops_OpenFPFromReadDir( RWOPS_READ, "r" );
    8.57 +   if (SDL_ATassert( "Failed to open file 'WOPS_READ", fp != NULL))
    8.58        return;
    8.59     rw = SDL_RWFromFP( fp, 1 );
    8.60     if (SDL_ATassert( "Opening memory with SDL_RWFromFP", rw != NULL ))
    8.61 @@ -241,12 +231,8 @@
    8.62     SDL_FreeRW( rw );
    8.63  
    8.64     /* Run write tests. */
    8.65 -#if __APPLE__
    8.66 -	fp = Test_OpenFPFromTemporaryDir( RWOPS_WRITE, "w+" );
    8.67 -#else
    8.68 -   fp = fopen( RWOPS_WRITE, "w+" );
    8.69 -#endif
    8.70 -   if (SDL_ATassert( "Failed to open file '"RWOPS_WRITE"'", fp != NULL))
    8.71 +   fp = TestSupportRWops_OpenFPFromWriteDir( RWOPS_WRITE, "w+" );
    8.72 +   if (SDL_ATassert( "Failed to open file RWOPS_WRITE", fp != NULL))
    8.73        return;
    8.74     rw = SDL_RWFromFP( fp, 1 );
    8.75     if (SDL_ATassert( "Opening memory with SDL_RWFromFP", rw != NULL ))