From 112e3537ff169734e27e893916bbbf8866e0edaf Mon Sep 17 00:00:00 2001 From: "R.E. Kovalev" Date: Wed, 5 Jul 2023 09:11:57 +0300 Subject: [PATCH] MinGW _wfopen_s fix --- tiny_gltf.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tiny_gltf.h b/tiny_gltf.h index 5ae87c0..9b318f2 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -2851,7 +2851,7 @@ bool FileExists(const std::string &abs_filename, void *) { } #else #ifdef _WIN32 -#if defined(_MSC_VER) || defined(__GLIBCXX__) || defined(_LIBCPP_VERSION) +#if defined(_MSC_VER) || defined(_LIBCPP_VERSION) // First check if a file is a directory. DWORD result = GetFileAttributesW(UTF8ToWchar(abs_filename).c_str()); @@ -2867,6 +2867,11 @@ bool FileExists(const std::string &abs_filename, void *) { if (err != 0) { return false; } +#elif defined(__GLIBCXX__) + FILE *fp = fopen(abs_filename.c_str(), "rb"); + if (!fp) { + return false; + } #else // TODO: is_directory check FILE *fp = nullptr;