Skip to content

Commit

Permalink
Fix truncating for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bugdea1er committed Jan 18, 2025
1 parent 2643fac commit 95fe3ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void file::write(std::string_view content, std::error_code& ec) const {
native_handle_type handle = native_handle();

#ifdef _WIN32
if (SetFilePointer(handle, 0, NULL, FILE_END) == INVALID_SET_FILE_POINTER ||
if (SetFilePointer(handle, 0, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER ||
!SetEndOfFile(handle)) {
ec = std::error_code(GetLastError(), std::system_category());
}
Expand Down

0 comments on commit 95fe3ac

Please sign in to comment.