Merge pull request #435 from RE-Kovalev/release

MinGW _wfopen_s fix
This commit is contained in:
Syoyo Fujita 2023-07-05 18:41:22 +09:00 committed by GitHub
commit aaf631c984
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2851,7 +2851,7 @@ bool FileExists(const std::string &abs_filename, void *) {
} }
#else #else
#ifdef _WIN32 #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. // First check if a file is a directory.
DWORD result = GetFileAttributesW(UTF8ToWchar(abs_filename).c_str()); DWORD result = GetFileAttributesW(UTF8ToWchar(abs_filename).c_str());
@ -2867,6 +2867,11 @@ bool FileExists(const std::string &abs_filename, void *) {
if (err != 0) { if (err != 0) {
return false; return false;
} }
#elif defined(__GLIBCXX__)
FILE *fp = fopen(abs_filename.c_str(), "rb");
if (!fp) {
return false;
}
#else #else
// TODO: is_directory check // TODO: is_directory check
FILE *fp = nullptr; FILE *fp = nullptr;