From 53cd9c4c3408b5f2e54e891baf471c0d774ea2cd Mon Sep 17 00:00:00 2001 From: nasr Date: Sat, 14 Mar 2026 21:40:32 +0000 Subject: feature(base): ascii colors, error framework ( ai help ). testing idea meta program. refactor --- source/base/base_os.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'source/base/base_os.h') diff --git a/source/base/base_os.h b/source/base/base_os.h index abe8628..9397fbb 100644 --- a/source/base/base_os.h +++ b/source/base/base_os.h @@ -2,21 +2,28 @@ #define BASE_OS_H internal string8 -load_file(const char *path) +load_file(mem_arena *arena, const char *path) { string8 result = {0}; struct stat sbuf = {0}; s32 file = open(path, O_RDONLY); - if(file == -1) return result; + if(file == -1) + { + warn("fialed to open file. path could be invalid"); + return (string8){0}; + } if(fstat(file, &sbuf) == -1) { - print("error: fstat failed"); + warn("error: fstat failed"); close(file); - return result; + return (string8){0}; } + + result = PushString(arena, sbuf.st_size); + result.size = (u64)sbuf.st_size; if(result.size != 0) { -- cgit v1.3