1#include "include/pw.h"
2#include "include/pwlib/path.h"
3
4[[nodiscard]] bool pw_dirname(PwValuePtr filename, PwValuePtr result)
5{
6 pw_assert(pw_is_string(filename));
7 PwValue parts = PW_NULL;
8 if (!pw_string_rsplit_chr(filename, '/', 1, &parts)) {
9 return false;
10 }
11 return pw_array_item(&parts, 0, result);
12}