Skip to content

Commit

Permalink
Updated FileUtils.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
baderouaich committed Jul 13, 2024
1 parent da0fafa commit e3a2149
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Utility/FileUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ namespace fs = std::experimental::filesystem;
#error compiler does not support std::filesystem
#endif
#include "FinalAction.hpp"
#if defined(ENIGMA_PLATFORM_WINDOWS)
#include <fcntl.h>
#include <io.h>
#endif

NS_ENIGMA_BEGIN
class FileUtils final {
Expand Down Expand Up @@ -108,6 +112,9 @@ class FileUtils final {
ENIGMA_ERROR("Failed to read file chunks {}", filename.string());
return;
}
#if defined(ENIGMA_PLATFORM_WINDOWS)
_setmode(_fileno(file), _O_BINARY);
#endif
FinalAction fileCloser([&file]{
std::fclose(file);
});
Expand Down

0 comments on commit e3a2149

Please sign in to comment.