From 0475aed939225042eb7a1401ea19d6f50d41a519 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 1 Aug 2021 04:04:25 +0200 Subject: [PATCH] [android] Allow FileExists to work on assets --- Source/utils/file_util.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/utils/file_util.cpp b/Source/utils/file_util.cpp index f61072427..e1195db3d 100644 --- a/Source/utils/file_util.cpp +++ b/Source/utils/file_util.cpp @@ -62,13 +62,13 @@ bool FileExists(const char *path) return false; } return true; -#elif _POSIX_C_SOURCE >= 200112L || defined(_BSD_SOURCE) || defined(__APPLE__) +#elif (_POSIX_C_SOURCE >= 200112L || defined(_BSD_SOURCE) || defined(__APPLE__)) && !defined(__ANDROID__) return ::access(path, F_OK) == 0; #else - FILE *file = std::fopen(path, "rb"); + SDL_RWops *file = SDL_RWFromFile(path, "r+b"); if (file == NULL) return false; - std::fclose(file); + SDL_RWclose(file); return true; #endif }