1 /*
2  * This software is licensed under the terms of the MIT License.
3  * See COPYING for further information.
4  * ---
5  * Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
6  * Copyright (c) 2012-2019, Andrei Alexeyev <akari@taisei-project.org>.
7  */
8 
9 #ifndef IGUARD_vfs_pathutil_h
10 #define IGUARD_vfs_pathutil_h
11 
12 #include "taisei.h"
13 
14 #include <SDL_platform.h>
15 
16 #define VFS_PATH_SEPARATOR_STR "/"
17 #define VFS_PATH_SEPARATOR VFS_PATH_SEPARATOR_STR[0]
18 #define VFS_IS_PATH_SEPARATOR(chr) ((chr) == VFS_PATH_SEPARATOR)
19 
20 static_assert(sizeof(VFS_PATH_SEPARATOR_STR) == 2, "No more than one VFS path separator, please");
21 
22 char* vfs_path_normalize(const char *path, char *out);
23 char* vfs_path_normalize_alloc(const char *path);
24 char* vfs_path_normalize_inplace(char *path);
25 void vfs_path_split_left(char *path, char **lpath, char **rpath);
26 void vfs_path_split_right(char *path, char **lpath, char **rpath);
27 void vfs_path_root_prefix(char *path);
28 void vfs_path_resolve_relative(char *buf, size_t bufsize, const char *basepath, const char *relpath); // NOTE: doesn't normalize
29 
30 #endif // IGUARD_vfs_pathutil_h
31