aboutsummaryrefslogtreecommitdiff
path: root/src/path.h
blob: 286c7e43ec5c5e8da67cf4edfd9964582d974522 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef PW_PATH_H
#define PW_PATH_H

#include <SDL3/SDL_stdinc.h>

/**
 * Returns the basename of `path` or `NULL` if `path` is `NULL`.
 */
char const *pw_basename(char const *path);

/**
 * Strips the extension from `path` into `name`. Returns the `false` if `name`
 * is not large enough.
 *
 * `name` must not overlap with `path`.
 */
bool pw_stripext(char *name, size_t sz, char const *path, char const *ext);

/**
 * Returns whether or not `path` has `ext`.
 */
bool pw_hasext(char const *path, char const *ext);

/**
 * Joins multiple components into `path`. returns `false` if `path` is not
 * large enough to fit all of the components.
 *
 * `path` must not overap with any of the segments, a final `NULL` segment must
 * be passed to signal end of arguments.
 */
bool pw_pathjoin(char *path, size_t sz, ...);

#endif