2025-10-04 00:46:26 +01:00
|
|
|
#if OS_WINDOWS
|
|
|
|
|
#include "impl/windows/core.c"
|
2025-10-04 00:56:55 +01:00
|
|
|
#elif OS_LINUX
|
|
|
|
|
#include "impl/linux/core.c"
|
2025-10-04 00:46:26 +01:00
|
|
|
#endif
|
2025-10-04 21:42:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
Str8 FS_ReadEntireFile(M_Arena *arena, Str8 path) {
|
|
|
|
|
Str8 result = { 0 };
|
|
|
|
|
|
|
|
|
|
OS_Handle file = FS_FileOpen(path, FS_ACCESS_READ);
|
|
|
|
|
if (file.v[0]) {
|
|
|
|
|
result.count = FS_FileSize(file);
|
|
|
|
|
result.data = M_ArenaPush(arena, U8, .count = result.count);
|
|
|
|
|
|
|
|
|
|
FS_FileRead(file, result.data, result.count, 0);
|
|
|
|
|
FS_FileClose(file);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|