libsysutils

view include/datapath.h @ 2:36936815cc92

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 08 May 2015 07:26:01 +0300
parents c1323f9f202d
children
line source
1 #ifndef LIBSYSUTILS_DATAPATH_H_
2 #define LIBSYSUTILS_DATAPATH_H_
4 enum sysu_dir_type {
5 SYSU_DATA_DIR, /* read-only assets directory */
6 SYSU_STORAGE_DIR, /* read-write persistent storage directory */
7 SYSU_CONFIG_DIR, /* configuration directory */
8 SYSU_TMP_DIR, /* temporary data directory */
9 SYSU_HOME_DIR, /* user's home directory */
10 SYSU_CURRENT_DIR /* current working directory */
11 };
13 int sysu_get_directory(enum sysu_dir_type type, char *buf, int sz);
15 /* Writes the path to outpath, and returns the size of the path in bytes.
16 * Call with len <= 0 and outpath == NULL to return required storage
17 * size for the path.
18 */
19 int sysu_datapath(const char *inpath, char *outpath, int len);
21 /* same as above, but stores the path to an internal static buffer,
22 * which will be overwritten or moved at the next call (thread unsafe).
23 */
24 const char *sysu_datapath_static(const char *inpath);
26 /* same as above, but allocates storage for the returned path
27 * which must be freed by a call to sysu_free_datapath.
28 */
29 char *sysu_datapath_alloc(const char *inpath);
30 void sysu_free_datapath(char *p);
32 #endif /* LIBSYSUTILS_DATAPATH_H_ */