From ca3eecf5c0dc25c7768bc24ee6da150af1e816d3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 28 Jun 2016 13:05:46 +0200 Subject: [PATCH] Create fill_pathname_join_noext --- libretro-common/file/file_path.c | 7 +++++++ libretro-common/include/file/file_path.h | 3 +++ menu/drivers/xmb.c | 3 +-- menu/menu_displaylist.c | 12 ++++-------- tasks/task_database.c | 4 +--- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index febfcac63a..fca2fb3749 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -574,6 +574,13 @@ void fill_pathname_join(char *out_path, retro_assert(strlcat(out_path, path, size) < size); } +void fill_pathname_join_noext(char *out_path, + const char *dir, const char *path, size_t size) +{ + fill_pathname_join(out_path, dir, path, size); + path_remove_extension(out_path); +} + void fill_string_join(char *out_path, const char *append, size_t size) { diff --git a/libretro-common/include/file/file_path.h b/libretro-common/include/file/file_path.h index a4a9a9063d..967d97e6f6 100644 --- a/libretro-common/include/file/file_path.h +++ b/libretro-common/include/file/file_path.h @@ -304,6 +304,9 @@ 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); +void fill_pathname_join_noext(char *out_path, + const char *dir, const char *path, size_t size); + /** * fill_string_join: * @out_path : output path diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 85ae1d6edc..ccfeebd395 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1033,12 +1033,11 @@ static void xmb_list_switch_new(xmb_handle_t *xmb, if (tmp) { - fill_pathname_join( + fill_pathname_join_noext( path, settings->directory.dynamic_wallpapers, tmp, sizeof(path)); - path_remove_extension(path); free(tmp); } diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index f83bff0491..8ae31047eb 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -114,13 +114,11 @@ static void print_buf_lines(file_list_t *list, char *buf, char core_path[PATH_MAX_LENGTH] = {0}; char *last = NULL; - fill_pathname_join( + fill_pathname_join_noext( core_path, settings->path.libretro_info, line_start, sizeof(core_path)); - - path_remove_extension(core_path); path_remove_extension(core_path); last = (char*)strrchr(core_path, '_'); if (*last) @@ -225,14 +223,13 @@ static void print_buf_lines_extended(file_list_t *list, char *buf, int buf_size, char display_name[PATH_MAX_LENGTH] = {0}; char *last = NULL; - fill_pathname_join( + fill_pathname_join_noext( core_path, settings->path.libretro_info, core_pathname, sizeof(core_path)); + path_remove_extension(core_path); - path_remove_extension(core_path); - path_remove_extension(core_path); last = (char*)strrchr(core_path, '_'); if (!string_is_empty(last)) { @@ -2754,9 +2751,8 @@ static int menu_displaylist_parse_horizontal_content_actions( { char db_path[PATH_MAX_LENGTH] = {0}; - fill_pathname_join(db_path, settings->path.content_database, + fill_pathname_join_noext(db_path, settings->path.content_database, db_name, sizeof(db_path)); - path_remove_extension(db_path); strlcat(db_path, file_path_str(FILE_PATH_RDB_EXTENSION), sizeof(db_path)); diff --git a/tasks/task_database.c b/tasks/task_database.c index 338bb8a601..1a41136dec 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -272,11 +272,9 @@ static int database_info_list_iterate_found_match( database_info_t *db_info_entry = &db_state->info->list[ db_state->entry_index]; - fill_short_pathname_representation(db_playlist_base_str, + fill_short_pathname_representation_noext(db_playlist_base_str, db_path, sizeof(db_playlist_base_str)); - path_remove_extension(db_playlist_base_str); - strlcat(db_playlist_base_str, file_path_str(FILE_PATH_LPL_EXTENSION), sizeof(db_playlist_base_str));