nuclear@0: #ifndef LIBSYSUTILS_DATAPATH_H_ nuclear@0: #define LIBSYSUTILS_DATAPATH_H_ nuclear@0: nuclear@0: enum sysu_dir_type { nuclear@0: SYSU_DATA_DIR, /* read-only assets directory */ nuclear@0: SYSU_STORAGE_DIR, /* read-write persistent storage directory */ nuclear@0: SYSU_CONFIG_DIR, /* configuration directory */ nuclear@0: SYSU_TMP_DIR, /* temporary data directory */ nuclear@0: SYSU_HOME_DIR, /* user's home directory */ nuclear@0: SYSU_CURRENT_DIR /* current working directory */ nuclear@0: }; nuclear@0: nuclear@2: int sysu_get_directory(enum sysu_dir_type type, char *buf, int sz); nuclear@0: nuclear@0: /* Writes the path to outpath, and returns the size of the path in bytes. nuclear@0: * Call with len <= 0 and outpath == NULL to return required storage nuclear@0: * size for the path. nuclear@0: */ nuclear@0: int sysu_datapath(const char *inpath, char *outpath, int len); nuclear@0: nuclear@0: /* same as above, but stores the path to an internal static buffer, nuclear@0: * which will be overwritten or moved at the next call (thread unsafe). nuclear@0: */ nuclear@0: const char *sysu_datapath_static(const char *inpath); nuclear@0: nuclear@0: /* same as above, but allocates storage for the returned path nuclear@0: * which must be freed by a call to sysu_free_datapath. nuclear@0: */ nuclear@0: char *sysu_datapath_alloc(const char *inpath); nuclear@0: void sysu_free_datapath(char *p); nuclear@0: nuclear@0: #endif /* LIBSYSUTILS_DATAPATH_H_ */