Paths
API for handling filesystem paths.
Functions
oc_path_slice_directory
oc_str8 oc_path_slice_directory(oc_str8 path);
Get a string slice of the directory part of a path.
Parameters
pathThe path to slice.
oc_path_slice_filename
oc_str8 oc_path_slice_filename(oc_str8 path);
Get a string slice of the file name part of a path.
Parameters
pathThe path to slice
oc_path_split
oc_str8_list oc_path_split(oc_arena* arena, oc_str8 path);
Split a path into path elements.
Parameters
arenaAn arena on which to allocate string list elements.pathThe path to slice.
Return
A string list of path elements. The strings in this list are slices into the input path, refering to the same backing memory.
oc_path_join
oc_str8 oc_path_join(oc_arena* arena, oc_str8_list elements);
Join path elements to form a path.
Parameters
arenaAn arena on which to allocate the resulting path.elementsA string list of path elements.
Return
The resulting path.
oc_path_append
oc_str8 oc_path_append(oc_arena* arena, oc_str8 parent, oc_str8 relPath);
Append a path to another path.
Parameters
arenaAn arena on which to allocate the resulting path.parentThe first part of the path.relPathThe relative path to append.
Return
The resulting path.
oc_path_is_absolute
bool oc_path_is_absolute(oc_str8 path);
Test wether a path is an absolute path.
Parameters
pathThe path to test.
Return
true if the path is absolute, false otherwise.