mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-10-08 22:59:54 +03:00
Do not use SDL_RWFromFile on Windows
It does not work in the MSVC build of SDL2 (although it works in Mingw-w64's SDL2 package). Fixes #11.
This commit is contained in:
@@ -23,3 +23,16 @@ SDL_RWops* open_resource(const char* name, const char* type) {
|
||||
return SDL_RWFromFile(path, "rb");
|
||||
#endif
|
||||
}
|
||||
|
||||
SDL_RWops* open_file(const char* name) {
|
||||
#ifdef __ANDROID__
|
||||
// We cannot use SDL_RWFromFile() because it does not resolve relative
|
||||
// paths using the current directory on Android.
|
||||
FILE *fp = fopen(name, "rb");
|
||||
if (!fp)
|
||||
return NULL;
|
||||
return SDL_RWFromFP(fp, SDL_TRUE);
|
||||
#else
|
||||
return SDL_RWFromFile(name, "rb");
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user