Don't use stat() on Android

h/t Pere
This commit is contained in:
Bill Kendrick 2025-03-27 20:20:02 -07:00
parent e3f9e5a246
commit e74cb54ccc

View file

@ -14356,16 +14356,20 @@ static SDL_Surface *load_starter_helper(char *path_and_basename,
char fname[256]; char fname[256];
SDL_Surface *surf; SDL_Surface *surf;
unsigned int i; unsigned int i;
#ifndef __ANDROID__
struct stat stat_buf; struct stat stat_buf;
#endif
ext = strdup(extension); ext = strdup(extension);
safe_snprintf(fname, sizeof(fname), "%s.%s", path_and_basename, ext); safe_snprintf(fname, sizeof(fname), "%s.%s", path_and_basename, ext);
#ifndef __ANDROID__
if (stat(fname, &stat_buf) != 0) if (stat(fname, &stat_buf) != 0)
{ {
/* File by that name doesn't exist; give up now */ /* File by that name doesn't exist; give up now */
return NULL; return NULL;
} }
#endif
surf = (*load_func) (fname); surf = (*load_func) (fname);
@ -21733,6 +21737,7 @@ static SDL_Surface *myIMG_Load_RWops(const char *file)
otherwise call SDL_Image lib's IMG_Load() (for PNGs, JPEGs, BMPs, etc.) */ otherwise call SDL_Image lib's IMG_Load() (for PNGs, JPEGs, BMPs, etc.) */
static SDL_Surface *myIMG_Load(const char *file) static SDL_Surface *myIMG_Load(const char *file)
{ {
#ifndef __ANDROID__
struct stat stat_buf; struct stat stat_buf;
if (stat(file, &stat_buf) != 0) if (stat(file, &stat_buf) != 0)
@ -21740,6 +21745,7 @@ static SDL_Surface *myIMG_Load(const char *file)
/* File by that name doesn't exist; give up now */ /* File by that name doesn't exist; give up now */
return NULL; return NULL;
} }
#endif
if (strlen(file) > 4 && strcasecmp(file + strlen(file) - 4, ".kpx") == 0) if (strlen(file) > 4 && strcasecmp(file + strlen(file) - 4, ".kpx") == 0)
{ {