GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
Utility functions for building paths. More...
Go to the source code of this file.
Macros | |
#define | gp_compose_path(dir, ...) gp_compose_path_(dir, ##__VA_ARGS__, NULL); |
Builds a path from directories passsed in arguments. | |
Enumerations | |
enum | gp_mkpath_flags { GP_MKPATH_HAS_FILE = 0x01 } |
Functions | |
char * | gp_user_home (void) |
Returns a user home directory. | |
int | gp_mkpath (const char *base_path, const char *path, enum gp_mkpath_flags flags, int mode) |
Creates a path, if it does not exists. | |
char * | gp_dirname (const char *path) |
Returns directory component of a path in a newly allocated buffer. | |
Utility functions for building paths.
Definition in file gp_path.h.
#define gp_compose_path | ( | dir, | |
... | |||
) | gp_compose_path_(dir, ##__VA_ARGS__, NULL); |
Builds a path from directories passsed in arguments.
The returned path is normalized, i.e. there are no two path delimiters '/' next to each other.
dir | A first directory in path. |
... | A NULL terminated list of path components. |
enum gp_mkpath_flags |
char * gp_dirname | ( | const char * | path | ) |
Returns directory component of a path in a newly allocated buffer.
path | A path. |
int gp_mkpath | ( | const char * | base_path, |
const char * | path, | ||
enum gp_mkpath_flags | flags, | ||
int | mode | ||
) |
Creates a path, if it does not exists.
Works similar to 'mkdir -p'. Hoever if last compoment of the path is a file, i.e. last path component does not end with '/' it's ignored.
base_path | A path to create the directories under, can be NULL. |
path | A path, one or more directories. |
flags | An enum gp_mkpath_flags. |
mode | A mode for the directories created in the path. |
char * gp_user_home | ( | void | ) |
Returns a user home directory.
The home directory is validated to be an absolute path.