From 4edf1116dc2b0b67b5c5efa8a2298a8d0832fac4 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 6 Apr 2026 22:12:22 -0700
Subject: [PATCH] Don't use physfs for the data path
It doesn't work on Android, since it doesn't use the asset manager.
---
utils/files.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/utils/files.c b/utils/files.c
index 2317aef5..e25fdbd8 100644
--- a/utils/files.c
+++ b/utils/files.c
@@ -94,11 +94,6 @@ bool InitFilesystem(const char *org, const char *app)
PHYSFS_mount(env, "/", true);
}
- if (!PHYSFS_mount(datapath, "/", true)) {
- SDL_SetError("Couldn't add %s to the mount path: %d", datapath, PHYSFS_getLastErrorCode());
- return false;
- }
-
return true;
}
@@ -109,7 +104,13 @@ void QuitFilesystem(void)
SDL_IOStream *OpenRead(const char *file)
{
- return PHYSFSSDL3_openRead(file);
+ SDL_IOStream *stream = PHYSFSSDL3_openRead(file);
+ if (!stream) {
+ char path[PATH_MAX];
+ SDL_snprintf(path, sizeof(path), "%s%s", datapath, file);
+ stream = SDL_IOFromFile(path, "rb");
+ }
+ return stream;
}
char *LoadFile(const char *file)