Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the pmode argument to _wopen to fix the access permission on MinGW #479

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tiny_gltf.h
Original file line number Diff line number Diff line change
Expand Up @@ -3151,7 +3151,7 @@ bool WriteWholeFile(std::string *err, const std::string &filepath,
#ifdef _WIN32
#if defined(__GLIBCXX__) // mingw
int file_descriptor = _wopen(UTF8ToWchar(filepath).c_str(),
_O_CREAT | _O_WRONLY | _O_TRUNC | _O_BINARY);
_O_CREAT | _O_WRONLY | _O_TRUNC | _O_BINARY, _S_IWRITE);
__gnu_cxx::stdio_filebuf<char> wfile_buf(
file_descriptor, std::ios_base::out | std::ios_base::binary);
std::ostream f(&wfile_buf);
Expand Down Expand Up @@ -7127,7 +7127,7 @@ static bool SerializeGltfBufferData(const std::vector<unsigned char> &data,
#ifdef _WIN32
#if defined(__GLIBCXX__) // mingw
int file_descriptor = _wopen(UTF8ToWchar(binFilename).c_str(),
_O_CREAT | _O_WRONLY | _O_TRUNC | _O_BINARY);
_O_CREAT | _O_WRONLY | _O_TRUNC | _O_BINARY, _S_IWRITE);
__gnu_cxx::stdio_filebuf<char> wfile_buf(
file_descriptor, std::ios_base::out | std::ios_base::binary);
std::ostream output(&wfile_buf);
Expand Down Expand Up @@ -8352,7 +8352,7 @@ static bool WriteGltfFile(const std::string &output,
std::ofstream gltfFile(UTF8ToWchar(output).c_str());
#elif defined(__GLIBCXX__)
int file_descriptor = _wopen(UTF8ToWchar(output).c_str(),
_O_CREAT | _O_WRONLY | _O_TRUNC | _O_BINARY);
_O_CREAT | _O_WRONLY | _O_TRUNC | _O_BINARY, _S_IWRITE);
__gnu_cxx::stdio_filebuf<char> wfile_buf(
file_descriptor, std::ios_base::out | std::ios_base::binary);
std::ostream gltfFile(&wfile_buf);
Expand Down Expand Up @@ -8437,7 +8437,7 @@ static bool WriteBinaryGltfFile(const std::string &output,
std::ofstream gltfFile(UTF8ToWchar(output).c_str(), std::ios::binary);
#elif defined(__GLIBCXX__)
int file_descriptor = _wopen(UTF8ToWchar(output).c_str(),
_O_CREAT | _O_WRONLY | _O_TRUNC | _O_BINARY);
_O_CREAT | _O_WRONLY | _O_TRUNC | _O_BINARY, _S_IWRITE);
__gnu_cxx::stdio_filebuf<char> wfile_buf(
file_descriptor, std::ios_base::out | std::ios_base::binary);
std::ostream gltfFile(&wfile_buf);
Expand Down
Loading