From 4ab0386d0926aa4e0630a0e1ade1dee6f2aa92a6 Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Sun, 10 Nov 2019 15:31:17 +0900 Subject: [PATCH] Fix MinGW code path reused linux code path. --- tiny_gltf.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tiny_gltf.h b/tiny_gltf.h index e84725a..f9ef35d 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -7208,7 +7208,9 @@ static void WriteBinaryGltfFile(const std::string &output, #if defined(_MSC_VER) std::ofstream gltfFile(UTF8ToWchar(output).c_str(), std::ios::binary); #elif defined(__GLIBCXX__) - std::ofstream gltfFile(output.c_str(), std::ios::binary); + int file_descriptor = _wopen(UTF8ToWchar(output).c_str(), _O_WRONLY | _O_BINARY); + __gnu_cxx::stdio_filebuf wfile_buf(file_descriptor, std::ios_base::in); + std::ostream gltfFile(&wfile_buf); #else std::ofstream gltfFile(output.c_str(), std::ios::binary); #endif