diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index 02cd5d021a..8c3dbb40cb 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -579,6 +579,15 @@ void fill_pathname_join(char *out_path, retro_assert(strlcat(out_path, path, size) < size); } +void fill_string_join(char *out_path, + const char *append, size_t size) +{ + if (*out_path) + fill_pathname_slash(out_path, size); + + retro_assert(strlcat(out_path, append, size) < size); +} + /** * fill_pathname_join_delim: * @out_path : output path diff --git a/libretro-common/include/file/file_path.h b/libretro-common/include/file/file_path.h index 62a4d3ab2a..a5bcfe4809 100644 --- a/libretro-common/include/file/file_path.h +++ b/libretro-common/include/file/file_path.h @@ -294,6 +294,19 @@ void fill_pathname_resolve_relative(char *out_path, const char *in_refpath, void fill_pathname_join(char *out_path, const char *dir, const char *path, size_t size); +/** + * fill_string_join: + * @out_path : output path + * @path : path + * @size : size of output path + * + * Joins a string (@out_path) and path (@append) together. + * Makes sure not to get two consecutive slashes + * between directory and path. + **/ +void fill_string_join(char *out_path, + const char *path, size_t size); + /** * fill_pathname_join_delim: * @out_path : output path