summaryrefslogtreecommitdiff
path: root/src/platform/path.c
blob: e67102b506b7651ab5628dd36c4efd9df67f6667 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "path.h"

#include <libgen.h>
#include <string.h>
#include "str.h"

#if defined(CEL_PLATFORM_LINUX) || defined(CEL_PLATFORM_MAC)
path_opt path_parent(const char* path) {
  char* path_dirname = dirname(path);
  return (path_opt){ .path = str8_cstr_view(path_dirname), .has_value = true };
}
#endif
#ifdef CEL_PLATFORM_WINDOWS
// TODO: path_opt path_parent(const char* path)
#endif