From b03bde3d412148cd573f5f14012cdd270f309947 Mon Sep 17 00:00:00 2001 From: omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Sun, 11 Aug 2024 23:00:26 +1000 Subject: starting work on immediate mode drawing --- src/platform/platform_unix.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/platform/platform_unix.c (limited to 'src/platform/platform_unix.c') diff --git a/src/platform/platform_unix.c b/src/platform/platform_unix.c new file mode 100644 index 0000000..86ac170 --- /dev/null +++ b/src/platform/platform_unix.c @@ -0,0 +1,16 @@ +#include "platform.h" + +#if defined(CEL_PLATFORM_LINUX) || defined(CEL_PLATFORM_MAC) + +#include +#include + +path_opt path_parent(arena* a, const char* path) { + // Duplicate the string because dirname doesnt like const literals + char* path_copy = arena_alloc(a, strlen(path) + 1); + strcpy(path_copy, path); + char* path_dirname = dirname(path_copy); + return (path_opt){ .path = Str8_cstr_view(path_dirname), .has_value = true }; +} + +#endif -- cgit v1.2.3-70-g09d2