From a0307589bde010f4942d1620b821e535be708dc9 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 2 Jan 2026 08:18:05 -0800
Subject: [PATCH] iOS: if the file doesn't exist in the pref path, use the
current directory
Fixes https://github.com/libsdl-org/SDL/issues/14743
---
src/filesystem/posix/SDL_sysfsops.c | 4 ++++
src/io/SDL_iostream.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/src/filesystem/posix/SDL_sysfsops.c b/src/filesystem/posix/SDL_sysfsops.c
index a18692749cec4..5e126b64a05a2 100644
--- a/src/filesystem/posix/SDL_sysfsops.c
+++ b/src/filesystem/posix/SDL_sysfsops.c
@@ -377,6 +377,10 @@ bool SDL_SYS_GetPathInfo(const char *path, SDL_PathInfo *info)
}
rc = stat(apath, &statbuf);
SDL_free(apath);
+
+ if (rc < 0) {
+ rc = stat(path, &statbuf);
+ }
}
#else
rc = stat(path, &statbuf);
diff --git a/src/io/SDL_iostream.c b/src/io/SDL_iostream.c
index e8533df7fb0f9..9639a66148c88 100644
--- a/src/io/SDL_iostream.c
+++ b/src/io/SDL_iostream.c
@@ -985,6 +985,10 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode)
fp = fopen(path, mode);
SDL_free(path);
+
+ if (!fp) {
+ fp = fopen(file, mode);
+ }
}
if (!fp) {