1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-08 12:15:49 +00:00

Remove fill_short_pathname_representation

This commit is contained in:
libretroadmin 2022-07-11 21:40:09 +02:00
parent b1c9f93903
commit b7926605f4
10 changed files with 31 additions and 69 deletions

View File

@ -493,8 +493,9 @@ bool gfx_thumbnail_set_content_playlist(
strlcpy(path_data->content_label,
content_label, sizeof(path_data->content_label));
else
fill_short_pathname_representation(path_data->content_label,
content_path, sizeof(path_data->content_label));
fill_pathname(path_data->content_label,
path_basename(content_path),
"", sizeof(path_data->content_label));
/* Determine content image name */
fill_content_img(path_data);

View File

@ -963,34 +963,6 @@ size_t fill_pathname_join_delim(char *out_path, const char *dir,
return copied;
}
/**
* fill_short_pathname_representation:
* @out_rep : output representation
* @in_path : input path
* @size : size of output representation
*
* Generates a short representation of path. It should only
* be used for displaying the result; the output representation is not
* binding in any meaningful way (for a normal path, this is the same as basename)
* In case of more complex URLs, this should cut everything except for
* the main image file.
*
* E.g.: "/path/to/game.img" -> game.img
* "/path/to/myarchive.7z#folder/to/game.img" -> game.img
*/
size_t fill_short_pathname_representation(char* out_rep,
const char *in_path, size_t size)
{
char path_short[NAME_MAX_LENGTH];
path_short[0] = '\0';
fill_pathname(path_short, path_basename(in_path), "",
sizeof(path_short));
return strlcpy(out_rep, path_short, size);
}
void fill_pathname_expand_special(char *out_path,
const char *in_path, size_t size)
{
@ -1133,7 +1105,7 @@ void pathname_conform_slashes_to_os(char *path)
*p = PATH_DEFAULT_SLASH_C();
}
/* Change all shashes to forward so they are more portable between windows and linux */
/* Change all shashes to forward so they are more portable between Windows and Linux */
void pathname_make_slashes_portable(char *path)
{
/* Conform slashes to os standard so we get proper matching */

View File

@ -406,24 +406,6 @@ size_t fill_pathname_join_concat_noext(char *out_path,
size_t fill_pathname_join_delim(char *out_path, const char *dir,
const char *path, const char delim, size_t size);
/**
* fill_short_pathname_representation:
* @out_rep : output representation
* @in_path : input path
* @size : size of output representation
*
* Generates a short representation of path. It should only
* be used for displaying the result; the output representation is not
* binding in any meaningful way (for a normal path, this is the same as basename)
* In case of more complex URLs, this should cut everything except for
* the main image file.
*
* E.g.: "/path/to/game.img" -> game.img
* "/path/to/myarchive.7z#folder/to/game.img" -> game.img
*/
size_t fill_short_pathname_representation(char* out_rep,
const char *in_path, size_t size);
void fill_pathname_expand_special(char *out_path,
const char *in_path, size_t size);

View File

@ -1312,8 +1312,8 @@ static bool manual_content_scan_get_playlist_content_label(
/* In most cases, content label is just the
* filename without extension */
fill_short_pathname_representation(
content_label, content_path, len);
fill_pathname(content_label, path_basename(content_path),
"", len);
if (string_is_empty(content_label))
return false;

View File

@ -5441,8 +5441,9 @@ static int action_ok_add_to_favorites(const char *path,
/* Label is empty - use file name instead */
if (string_is_empty(content_label))
fill_short_pathname_representation(content_label,
content_path, sizeof(content_label));
fill_pathname(content_label,
path_basename(content_path), "",
sizeof(content_label));
/* > core_path + core_name */
if (system)
@ -5579,7 +5580,9 @@ static int action_ok_add_to_favorites_playlist(const char *path,
/* Label is empty - use file name instead */
char fallback_content_label[PATH_MAX_LENGTH];
fallback_content_label[0] = '\0';
fill_short_pathname_representation(fallback_content_label, entry->path, sizeof(fallback_content_label));
fill_pathname(fallback_content_label,
path_basename(entry->path), "",
sizeof(fallback_content_label));
string_list_append(str_list, fallback_content_label, attr);
}

View File

@ -3283,7 +3283,7 @@ static int xmb_draw_item(
entry_path[0] = '\0';
strlcpy(entry_path, entry.path, sizeof(entry_path));
fill_short_pathname_representation(entry_path, entry_path,
fill_pathname(entry_path, path_basename(entry_path), "",
sizeof(entry_path));
if (!string_is_empty(entry_path))

View File

@ -2210,7 +2210,9 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
* no further action is necessary */
if (string_is_empty(entry->label))
fill_short_pathname_representation(menu_entry_label, entry->path, sizeof(menu_entry_label));
fill_pathname(menu_entry_label,
path_basename(entry->path),
"", sizeof(menu_entry_label));
else
strlcpy(menu_entry_label, entry->label, sizeof(menu_entry_label));
@ -2411,11 +2413,10 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
database_info_build_query_enum(query, sizeof(query),
DATABASE_QUERY_ENTRY, info->path_b);
db_info = database_info_list_new(info->path, query);
if (!db_info)
if (!(db_info = database_info_list_new(info->path, query)))
goto error;
fill_short_pathname_representation(path_base, info->path,
fill_pathname(path_base, path_basename(info->path), "",
sizeof(path_base));
path_remove_extension(path_base);
@ -2427,9 +2428,8 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
sizeof(path_playlist));
playlist_config_set_path(&playlist_config, path_playlist);
playlist = playlist_init(&playlist_config);
if (playlist)
if ((playlist = playlist_init(&playlist_config)))
strlcpy(menu->db_playlist_file, path_playlist,
sizeof(menu->db_playlist_file));

View File

@ -1292,7 +1292,8 @@ static void setting_get_string_representation_st_path(rarch_setting_t *setting,
char *s, size_t len)
{
if (setting)
fill_short_pathname_representation(s, setting->value.target.string, len);
fill_pathname(s, path_basename(setting->value.target.string),
"", len);
}
static void setting_get_string_representation_st_string(rarch_setting_t *setting,
@ -3069,7 +3070,8 @@ static void setting_get_string_representation_video_filter(rarch_setting_t *sett
if (!setting)
return;
fill_short_pathname_representation(s, setting->value.target.string, len);
fill_pathname(s, path_basename(setting->value.target.string),
"", len);
}
static void setting_get_string_representation_state_slot(rarch_setting_t *setting,

View File

@ -2984,7 +2984,8 @@ static int playlist_qsort_func(const struct playlist_entry *a,
goto end;
if (!string_is_empty(a->path))
fill_short_pathname_representation(a_fallback_label, a->path, PATH_MAX_LENGTH * sizeof(char));
fill_pathname(a_fallback_label, path_basename(a->path),
"", PATH_MAX_LENGTH * sizeof(char));
/* If filename is also empty, use core name
* instead -> this matches the behaviour of
* menu_displaylist_parse_playlist() */
@ -3007,7 +3008,8 @@ static int playlist_qsort_func(const struct playlist_entry *a,
goto end;
if (!string_is_empty(b->path))
fill_short_pathname_representation(b_fallback_label, b->path, PATH_MAX_LENGTH * sizeof(char));
fill_pathname(b_fallback_label, path_basename(b->path), "",
PATH_MAX_LENGTH * sizeof(char));
else if (!string_is_empty(b->core_name))
strlcpy(b_fallback_label, b->core_name, PATH_MAX_LENGTH * sizeof(char));

View File

@ -756,8 +756,8 @@ static int database_info_list_iterate_found_match(
db_playlist_base_str[0] = '\0';
entry_path_str[0] = '\0';
fill_short_pathname_representation(db_playlist_base_str,
db_path, str_len);
fill_pathname(db_playlist_base_str,
path_basename(db_path), "", str_len);
path_remove_extension(db_playlist_base_str);
strlcat(db_playlist_base_str, ".lpl", str_len);
@ -1012,8 +1012,8 @@ static int task_database_iterate_playlist_lutro(
game_title[0] = '\0';
fill_short_pathname_representation(game_title,
path, sizeof(game_title));
fill_pathname(game_title,
path_basename(path), "", sizeof(game_title));
path_remove_extension(game_title);
/* the push function reads our entry as const,