From 9382f127ccebdd59917c97c61d008ed0e127cd75 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Sat, 28 Nov 2009 13:11:51 +0100 Subject: Engine and VFS API cleanup Also enable symlink resolving by default. --- common/strutils.h | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'common/strutils.h') diff --git a/common/strutils.h b/common/strutils.h index 84f6013..7fed4c5 100644 --- a/common/strutils.h +++ b/common/strutils.h @@ -20,32 +20,36 @@ #ifndef __STRUTILS_H__ #define __STRUTILS_H__ - - -#include -#include +#ifdef __cplusplus + extern "C" { +#endif #ifdef __VERBOSE_DEBUG - #define log(msg...) printf(msg) + #define log(msg...) g_print(msg) #else #define log(msg...) { } #endif -#define IS_DIR_SEP(ch) ((ch) == '/') +/* path manipulating functions, all return newly allocated string */ +char * include_trailing_path_sep (const char *APath); +char * exclude_trailing_path_sep (const char *APath); +char * include_leading_path_sep (const char *APath); +char * exclude_leading_path_sep (const char *APath); + +char * resolve_relative (const char *source, const char *point_to); -// path manipulating functions, all return newly allocated string, you can then free them as you want -char* include_trailing_path_sep(const char *APath); -char* exclude_trailing_path_sep(const char *APath); -char* include_leading_path_sep(const char *APath); -char* exclude_leading_path_sep(const char *APath); -char* extract_file_name(const char *APath); -char* extract_file_path(const char *APath); -char* resolve_relative(const char *source, const char *point_to); -char* canonicalize_filename(const char *filename); +/* split the first path element (single level) and copy the rest (multiple levels) */ +void split_path (const char *path, char **first_part, char **last_part); -char* wide_to_utf8(const wchar_t *src); +char * canonicalize_filename (const char *filename); +char * wide_to_utf8 (const wchar_t *src); + + +#ifdef __cplusplus + } +#endif #endif /* __STRUTILS_H__ */ -- cgit v1.2.3