diff --git a/audio/audio_driver.c b/audio/audio_driver.c index cad0d64ee3..c04fbbc048 100644 --- a/audio/audio_driver.c +++ b/audio/audio_driver.c @@ -1405,7 +1405,8 @@ void audio_driver_load_system_sounds(void) if (audio_driver_mixer_extension_supported(ext)) { basename_noext[0] = '\0'; - fill_pathname_base_noext(basename_noext, path, sizeof(basename_noext)); + fill_pathname_base(basename_noext, path, sizeof(basename_noext)); + path_remove_extension(basename_noext); if (string_is_equal_noncase(basename_noext, "ok")) path_ok = path; diff --git a/command.c b/command.c index 1a4838163b..74202fe951 100644 --- a/command.c +++ b/command.c @@ -1457,10 +1457,8 @@ bool command_event_save_core_config( char tmp[PATH_MAX_LENGTH + 8]; RARCH_LOG("[Config]: %s\n", msg_hash_to_str(MSG_USING_CORE_NAME_FOR_NEW_CONFIG)); - fill_pathname_base_noext( - config_name, - core_path, - sizeof(config_name)); + fill_pathname_base(config_name, core_path, sizeof(config_name)); + path_remove_extension(config_name); fill_pathname_join(config_path, config_dir, config_name, sizeof(config_path)); diff --git a/gfx/widgets/gfx_widget_load_content_animation.c b/gfx/widgets/gfx_widget_load_content_animation.c index 7c155afdc9..f5536c5ea1 100644 --- a/gfx/widgets/gfx_widget_load_content_animation.c +++ b/gfx/widgets/gfx_widget_load_content_animation.c @@ -395,8 +395,9 @@ bool gfx_widget_start_load_content_animation(void) if (!string_is_empty(playlist_path)) { - fill_pathname_base_noext(state->system_name, playlist_path, + fill_pathname_base(state->system_name, playlist_path, sizeof(state->system_name)); + path_remove_extension(state->system_name); /* Exclude history and favourites playlists */ if (string_ends_with_size(state->system_name, "_history", @@ -418,8 +419,11 @@ bool gfx_widget_start_load_content_animation(void) /* If we haven't yet set the content name, * use content file name as a fallback */ if (!has_content) - fill_pathname_base_noext(state->content_name, content_path, + { + fill_pathname_base(state->content_name, content_path, sizeof(state->content_name)); + path_remove_extension(state->content_name); + } /* Check whether system name has been set */ if (!has_system) diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index 21131dcd2a..b0bdd825a1 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -381,22 +381,12 @@ size_t fill_pathname_base(char *out, const char *in_path, size_t size) return strlcpy(out, in_path, size); } -void fill_pathname_base_noext(char *out, - const char *in_path, size_t size) -{ - const char *ptr = path_basename(in_path); - if (ptr) - strlcpy(out, ptr, size); - else - strlcpy(out, in_path, size); - path_remove_extension(out); -} - size_t fill_pathname_base_ext(char *out, const char *in_path, const char *ext, size_t size) { - fill_pathname_base_noext(out, in_path, size); + fill_pathname_base(out, in_path, size); + path_remove_extension(out); return strlcat(out, ext, size); } @@ -1446,3 +1436,14 @@ size_t fill_pathname_noext(char *out_path, const char *in_path, strlcpy(out_path, in_path, size); return strlcat(out_path, replace, size); } + +void fill_pathname_base_noext(char *out, + const char *in_path, size_t size) +{ + const char *ptr = path_basename(in_path); + if (ptr) + strlcpy(out, ptr, size); + else + strlcpy(out, in_path, size); + path_remove_extension(out); +} diff --git a/libretro-common/include/file/file_path.h b/libretro-common/include/file/file_path.h index a6404dd02d..a535390bc2 100644 --- a/libretro-common/include/file/file_path.h +++ b/libretro-common/include/file/file_path.h @@ -308,9 +308,6 @@ size_t fill_pathname_dir(char *in_dir, const char *in_basename, **/ size_t fill_pathname_base(char *out_path, const char *in_path, size_t size); -void fill_pathname_base_noext(char *out_dir, - const char *in_path, size_t size); - size_t fill_pathname_base_ext(char *out, const char *in_path, const char *ext, size_t size); @@ -556,6 +553,9 @@ size_t fill_pathname_join_delim_concat(char *out_path, const char *dir, size_t fill_pathname_noext(char *out_path, const char *in_path, const char *replace, size_t size); +void fill_pathname_base_noext(char *out_dir, + const char *in_path, size_t size); + RETRO_END_DECLS #endif diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index dbe65485ba..bd1dca9853 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1367,7 +1367,8 @@ int generic_action_ok_displaylist_push(const char *path, settings->paths.path_content_database, path, sizeof(tmp)); - fill_pathname_base_noext(lpl_basename, path, sizeof(lpl_basename)); + fill_pathname_base(lpl_basename, path, sizeof(lpl_basename)); + path_remove_extension(lpl_basename); menu_driver_set_thumbnail_system(lpl_basename, sizeof(lpl_basename)); info.directory_ptr = idx; diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index 7b39cf57bc..75333d476a 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -4252,8 +4252,9 @@ static void ozone_init_horizontal_list(ozone_handle_t *ozone, } /* Remove extension */ - fill_pathname_base_noext(playlist_file_noext, + fill_pathname_base(playlist_file_noext, playlist_file, sizeof(playlist_file_noext)); + path_remove_extension(playlist_file_noext); console_name = playlist_file_noext; @@ -4377,7 +4378,8 @@ static void ozone_context_reset_horizontal_list(ozone_handle_t *ozone) sysname[0] = texturepath[0] = content_texturepath[0] = '\0'; - fill_pathname_base_noext(sysname, path, sizeof(sysname)); + fill_pathname_base(sysname, path, sizeof(sysname)); + path_remove_extension(sysname); fill_pathname_join(texturepath, icons_path, sysname, sizeof(texturepath)); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 6cb66fd647..4af29ba974 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1937,8 +1937,9 @@ static void xmb_set_title(xmb_handle_t *xmb) if (!path) return; - fill_pathname_base_noext( + fill_pathname_base( xmb->title_name, path, sizeof(xmb->title_name)); + path_remove_extension(xmb->title_name); /* Add current search terms */ menu_entries_search_append_terms_string( @@ -2262,7 +2263,8 @@ static void xmb_context_reset_horizontal_list( iconpath[0] = sysname[0] = texturepath[0] = content_texturepath[0] = '\0'; - fill_pathname_base_noext(sysname, path, sizeof(sysname)); + fill_pathname_base(sysname, path, sizeof(sysname)); + path_remove_extension(sysname); fill_pathname_application_special(iconpath, sizeof(iconpath), APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS); diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 660d670cb6..1562fc5cf5 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -2157,7 +2157,8 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, char lpl_basename[256]; lpl_basename[0] = '\0'; - fill_pathname_base_noext(lpl_basename, info->path, sizeof(lpl_basename)); + fill_pathname_base(lpl_basename, info->path, sizeof(lpl_basename)); + path_remove_extension(lpl_basename); menu_driver_set_thumbnail_system(lpl_basename, sizeof(lpl_basename)); } @@ -3300,7 +3301,8 @@ static int menu_displaylist_parse_horizontal_list( /* Thumbnail system must be set *after* playlist * is loaded/cached */ - fill_pathname_base_noext(lpl_basename, item->path, sizeof(lpl_basename)); + fill_pathname_base(lpl_basename, item->path, sizeof(lpl_basename)); + path_remove_extension(lpl_basename); menu_driver_set_thumbnail_system(lpl_basename, sizeof(lpl_basename)); } diff --git a/playlist.c b/playlist.c index e15911e950..02e9e1b3b3 100644 --- a/playlist.c +++ b/playlist.c @@ -1269,7 +1269,9 @@ bool playlist_push(playlist_t *playlist, if (string_is_empty(core_name)) { static char base_path[255] = {0}; - fill_pathname_base_noext(base_path, real_core_path, sizeof(base_path)); + fill_pathname_base(base_path, real_core_path, sizeof(base_path)); + path_remove_extension(base_path); + core_name = base_path; if (string_is_empty(core_name)) diff --git a/tasks/task_content.c b/tasks/task_content.c index 0c6943b939..f89cc96e2e 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -596,7 +596,8 @@ static bool content_file_list_set_info( * searching related content. For archived content, * this is the basename of the archive file without * extension */ - fill_pathname_base_noext(name, archive_path, sizeof(name)); + fill_pathname_base(name, archive_path, sizeof(name)); + path_remove_extension(name); file_info->file_in_archive = true; } @@ -609,7 +610,8 @@ static bool content_file_list_set_info( /* For uncompressed content, 'canonical' name/id * is the basename of the content file, without * extension */ - fill_pathname_base_noext(name, path, sizeof(name)); + fill_pathname_base(name, path, sizeof(name)); + path_remove_extension(name); } if (!string_is_empty(dir)) diff --git a/tasks/task_playlist_manager.c b/tasks/task_playlist_manager.c index e65b115cf0..9f6dfd532f 100644 --- a/tasks/task_playlist_manager.c +++ b/tasks/task_playlist_manager.c @@ -211,7 +211,8 @@ static void task_pl_manager_reset_cores_handler(retro_task_t *task) char entry_name[PATH_MAX_LENGTH]; entry_name[0] = '\0'; - fill_pathname_base_noext(entry_name, entry->path, sizeof(entry_name)); + fill_pathname_base(entry_name, entry->path, sizeof(entry_name)); + path_remove_extension(entry_name); strlcat(task_title, entry_name, sizeof(task_title)); } @@ -305,8 +306,9 @@ bool task_push_pl_manager_reset_cores(const playlist_config_t *playlist_config) if (string_is_empty(playlist_config->path)) goto error; - fill_pathname_base_noext(playlist_name, + fill_pathname_base(playlist_name, playlist_config->path, sizeof(playlist_name)); + path_remove_extension(playlist_name); if (string_is_empty(playlist_name)) goto error; @@ -735,8 +737,9 @@ bool task_push_pl_manager_clean_playlist( if (string_is_empty(playlist_config->path)) goto error; - fill_pathname_base_noext(playlist_name, + fill_pathname_base(playlist_name, playlist_config->path, sizeof(playlist_name)); + path_remove_extension(playlist_name); if (string_is_empty(playlist_name)) goto error;