Ver Fonte

iOS: if the file doesn't exist in the pref path, use the current directory

Fixes https://github.com/libsdl-org/SDL/issues/14743

(cherry picked from commit a0307589bde010f4942d1620b821e535be708dc9)
Sam Lantinga há 2 meses atrás
pai
commit
3d651ee403
2 ficheiros alterados com 8 adições e 0 exclusões
  1. 4 0
      src/filesystem/posix/SDL_sysfsops.c
  2. 4 0
      src/io/SDL_iostream.c

+ 4 - 0
src/filesystem/posix/SDL_sysfsops.c

@@ -377,6 +377,10 @@ bool SDL_SYS_GetPathInfo(const char *path, SDL_PathInfo *info)
         }
         }
         rc = stat(apath, &statbuf);
         rc = stat(apath, &statbuf);
         SDL_free(apath);
         SDL_free(apath);
+
+        if (rc < 0) {
+            rc = stat(path, &statbuf);
+        }
     }
     }
 #else
 #else
     rc = stat(path, &statbuf);
     rc = stat(path, &statbuf);

+ 4 - 0
src/io/SDL_iostream.c

@@ -985,6 +985,10 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode)
 
 
         fp = fopen(path, mode);
         fp = fopen(path, mode);
         SDL_free(path);
         SDL_free(path);
+
+        if (!fp) {
+            fp = fopen(file, mode);
+        }
     }
     }
 
 
     if (!fp) {
     if (!fp) {