Add macOS support

This commit is contained in:
momo5502
2025-01-05 17:07:12 +01:00
parent 0791b0fca7
commit 6b172f5e78
10 changed files with 61 additions and 22 deletions

View File

@@ -30,12 +30,20 @@
#define NO_INLINE __attribute__((noinline))
#define DECLSPEC_ALIGN(n) alignas(n)
#define _fseeki64 fseeko64
#define _ftelli64 ftello64
#define fopen_s fopen
#define RESTRICTED_POINTER __restrict
// TODO: warning stdcall problem
#define WINAPI
#ifdef OS_MAC
#define _fseeki64 fseeko
#define _ftelli64 ftello
#define _stat64 stat
#else
#define _fseeki64 fseeko64
#define _ftelli64 ftello64
#define _stat64 stat64
#endif
#endif

View File

@@ -28,12 +28,12 @@ namespace utils::io
io::create_directory(file.parent_path());
}
std::basic_ofstream<uint8_t> stream(
std::ofstream stream(
file, std::ios::binary | std::ofstream::out | (append ? std::ofstream::app : std::ofstream::out));
if (stream.is_open())
{
stream.write(data.data(), static_cast<std::streamsize>(data.size()));
stream.write(reinterpret_cast<const char*>(data.data()), static_cast<std::streamsize>(data.size()));
stream.close();
return true;
}