impr: Don't memory map files, never keep a write handle open for long

Closes #592
This commit is contained in:
WerWolv
2023-02-17 10:26:09 +01:00
parent e48761b5c0
commit bf8089dc7e
5 changed files with 72 additions and 119 deletions

View File

@@ -8,12 +8,20 @@
#include <hex/helpers/fs.hpp>
#include <sys/stat.h>
#if defined(OS_MACOS)
#include <unistd.h>
#include <sys/fcntl.h>
#define off64_t off_t
#define fopen64 fopen
#define fseeko64 fseek
#define ftello64 ftell
#define ftruncate64 ftruncate
#elif defined(OS_LINUX)
#include <unistd.h>
#include <fcntl.h>
#endif
namespace hex::fs {
@@ -65,6 +73,8 @@ namespace hex::fs {
void disableBuffering();
std::optional<struct stat> getFileInfo();
private:
FILE *m_file;
std::fs::path m_path;