annotate test/automated/rwops/TestSupportRWops_Generic.c @ 4451:033c455bbe99

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.)
author Eric Wing <ewing . public |-at-| gmail . com>
date Sun, 09 May 2010 06:58:30 -0700
parents
children 27ab20a36eba
rev   line source
4451
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
1 /* Generic implementation for file opening routines.
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
2 * Customizations for specific platforms should go in alternative files.
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
3 */
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
4 #include <stdio.h>
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
5 #include "SDL.h"
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
6
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
7 const char* RWOPS_READ = "rwops/read";
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
8 const char* RWOPS_WRITE = "rwops/write";
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
9
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
10 FILE* TestSupportRWops_OpenFPFromReadDir(const char *file, const char *mode)
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
11 {
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
12 return fopen(file, mode);
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
13 }
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
14
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
15 FILE* TestSupportRWops_OpenFPFromWriteDir(const char *file, const char *mode)
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
16 {
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
17 return fopen(file, mode);
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
18 }
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
19
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
20 SDL_RWops* TestSupportRWops_OpenRWopsFromReadDir(const char *file, const char *mode)
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
21 {
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
22 return SDL_RWFromFile(file, mode);
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
23 }
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
24
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
25 SDL_RWops* TestSupportRWops_OpenRWopsFromWriteDir(const char *file, const char *mode)
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
26 {
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
27 return SDL_RWFromFile(file, mode);
033c455bbe99 Refactored automated rwops tests so read and write directories can be more easily customized.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
28 }