#ifndef CPATH_H #define CPATH_H #include "aliases.h" #include "platform.h" #ifdef __cplusplus BEGIN_C_LINKAGE #endif // __cplusplus #ifdef WAPP_PLATFORM_POSIX #define PATH_SEP '/' #elif defined(WAPP_PLATFORM_WINDOWS) #define PATH_SEP '\\' #else #error "Unrecognised platform" #endif #define NUMPARTS(...) (sizeof((const char *[]){"", __VA_ARGS__}) / sizeof(const char *) - 1) #define wapp_cpath_join_path(DST, ...) join_path(DST, NUMPARTS(__VA_ARGS__), __VA_ARGS__) #define wapp_cpath_dirname(DST, PATH) dirup(DST, 1, PATH) #define wapp_cpath_dirup(DST, COUNT, PATH) dirup(DST, COUNT, PATH) void join_path(char *dst, u64 count, ...); void dirup(char *dst, u64 levels, const char *path); #ifdef __cplusplus END_C_LINKAGE #endif // __cplusplus #endif // !PATH_UTILS_H