Skip to content

Commit

Permalink
windows: Allow writing to file that is read
Browse files Browse the repository at this point in the history
  • Loading branch information
autoantwort committed Aug 28, 2023
1 parent c67d769 commit 4a2d427
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/vcpkg/base/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1415,9 +1415,10 @@ namespace vcpkg
ReadFilePointer::ReadFilePointer(const Path& file_path, std::error_code& ec) : FilePointer(file_path)
{
#if defined(_WIN32)
ec.assign(::_wfopen_s(&m_fs, to_stdfs_path(file_path).c_str(), L"rb"), std::generic_category());
m_fs = ::_wfsopen(to_stdfs_path(file_path).c_str(), L"rb", _SH_DENYNO);
#else // ^^^ _WIN32 / !_WIN32 vvv
m_fs = ::fopen(file_path.c_str(), "rb");
#endif // ^^^ !_WIN32
if (m_fs)
{
ec.clear();
Expand All @@ -1426,7 +1427,6 @@ namespace vcpkg
{
ec.assign(errno, std::generic_category());
}
#endif // ^^^ !_WIN32
}

ReadFilePointer& ReadFilePointer::operator=(ReadFilePointer&& other) noexcept
Expand Down

0 comments on commit 4a2d427

Please sign in to comment.