summaryrefslogtreecommitdiff
path: root/src/platform/platform_unix.c
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-08-11 23:00:26 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-08-11 23:00:26 +1000
commitb03bde3d412148cd573f5f14012cdd270f309947 (patch)
tree848af582079a60787cc5a5f8138e7ca6d508f2ee /src/platform/platform_unix.c
parent48a703e52490cb52fd32e54e3e37f7e70462a267 (diff)
starting work on immediate mode drawing
Diffstat (limited to 'src/platform/platform_unix.c')
-rw-r--r--src/platform/platform_unix.c16
1 files changed, 16 insertions, 0 deletions
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 <libgen.h>
+#include <string.h>
+
+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